3 ms·
One more broken part is CMD [ "python", "./yourscript.py" ] This breaks if you want to debug yourscript.py on startup. Better use a sh to wrap it.
by est 7y ago
One more broken part is
CMD [ "python", "./yourscript.py" ]
This breaks if you want to debug yourscript.py on startup. Better use a sh to wrap it.
- deathanatos 7y agoWhy/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. »