Docker
Useful concepts and snippets for using Docker
Guidelines
Always add .dockerignore file.
Try to use and exploit multi-stage builds.
Recipes
Installing Docker
Installing Docker-compose
Dockerfile With python venv's
Remove all exited containers: docker rm $(docker ps -a -f status=exited -q)
Building docker images:
https://codefresh.io/docker-tutorial/build-docker-image-dockerfiles/
Remove all images docker rmi $(docker images -a -q)
Remove dangling images
docker image prune
Remove dangling volume
docker volume prune
Kill all system garbage
docker system prune
Run container
**Add parameters to docker image build **
Tag image for pushing
Building local image into docker-compose:
https://stackoverflow.com/questions/46032392/docker-compose-does-not-allow-to-use-local-images
Resources
https://pythonspeed.com/articles/multi-stage-docker-python/
https://medium.com/capital-one-tech/multi-stage-builds-and-dockerfile-b5866d9e2f84
https://pythonspeed.com/docker/
Bridget Kromhout has a useful blog post on running Docker in production at Dramafever.
There's also a best practices blog post from Lyst.
Last updated