Dockerfile copies python parts, including the entrypoint.py file to the image. Build this:
docker build -t sample-python-app-subprocess .
Run:
# Prebuilt version
docker run thedoh/sample-python-app-subprocess:latest
# Build it yourself version
docker run sample-python-app-subprocess
- Docker starts this image
- CMD calls
/python -s -S /entrypoint.py
entrypoint.py
usessubprocess.call to call
/python -s -S /myapp.py` as a sub-process (ie, child process of pid 1)- Execution begins from within
myapp.py
, being executed by/python
(the static binary) - When
myapp.py
finishes running then execution is returned toentrypoint.py
just after thesubprocess.call
line.