/best_python_dockerfile_ever

Best Python Dockerfile ever, why would I lie? 😜

Primary LanguagePython

The best Python Dockerfile ever

Invoking Cunningham's Law, this is the best Dockerfile for a hello world Python web app, in other words https://xkcd.com/386/ ;-)

Build

docker build -t best_python_docker .

Running

Docker Compose:

echo Open http://localhost:1234/
docker  compose up
#docker-compose up

Plain docker (no compose) run:

echo Open http://localhost:1234/
#docker run -p 8000:8000 --name best_python_docker --hostname bpd --restart=unless-stopped best_python_docker
docker  run -p 1234:8000 --name best_python_docker --hostname bpd --restart=unless-stopped best_python_docker

Running on a public machine with https and LetsEncrypt generated certificates using Caddy

echo Open https://noauth.host_from_caddy_file:2000/
echo Open https://Bob:hiccup@withauth.host_from_caddy_file:2000/
docker  compose -f docker-compose_caddy.yml up
#docker-compose -f docker-compose_caddy.yml up

Notes

Useful commands:

# Show size
docker images best_python_docker

# remove container (not image)
docker rm best_python_docker

# remove image
docker image rm best_python_docker

# show layer sizes
docker history best_python_docker

# Connect to running container with an iteractive shell
docker exec -it best_python_docker /bin/sh

TODO