Template for dockerized applications developed in Python3
- Base image: python:3-alpine
- Build
docker build -t <image_tag> .
- Run
docker run -i -t --rm <image_tag>
For additional information about build and run commands:
docker build --help
docker run --help
A simplified version is available by using the build.py and run.py scripts. These will take the name of the root directory as the image tag.
python build.py # equivalent to "docker build -t docker-python3-template"
python run.py # equivalent to "docker run -i -t --rm docker-python3-template"
- In case of installing new dependencies, requirements.txt needs to be updated before build.
# after pip install
pip freeze > requirements.txt
- To modify the Docker image you only need to modify the file called Dockerfile. More information about Dockerfile here.