Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why/what do you think this breaks / what does wrapping it in a shell do for you?

E.g., for me, the following Dockerfile:

  FROM python:3

  RUN pip3 install ipdb

  COPY test.py /test.py
  CMD ["python", "test.py"]
where test.py is:

  import ipdb; ipdb.set_trace()
  print('Hello, World.')
run as `docker run -ti --rm $IMAGE_ID` works as expected:

  » docker run -ti --rm 52e98c118dc3
  > /test.py(2)<module>()
        1 import ipdb; ipdb.set_trace()
  ----> 2 print('Hello, World.')

  ipdb> p globals()
  {'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <_frozen_importlib_external.SourceFileLoader object at 0x7f809a8c8278>, '__spec__': None, '__annotations__': {}, '__builtins__': <module 'builtins' (built-in)>, '__file__': 'test.py', '__cached__': None, 'ipdb': <module 'ipdb' from '/usr/local/lib/python3.7/site-packages/ipdb/__init__.py'>}
  ipdb> ^D

  Exiting Debugger.

  »


Can you add extra environ before python executes any code?


Did you even try ?

`docker exec -e foo=bar -it ....`




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: