golb

Docker

Options

docker run -it debian
docker run -e FOO=bar debian
docker run -v $(pwd):/mnt debian
docker run -d  debian

Build

docker build -t my_debian .
# then
docker run my_debian

-t: tag the image

Known bug on MacOs Apple Silicon

You need to add --platform linux/amd64 (for example) to use the amd64 because by default, it use the platform of the computer (arm64)

You need to add this option during docker build and docker run commands

Run nginx on docker

It's useful to add

CMD ["nginx", "-g", "'daemon off;'"]

to force nginx to run in foreground (and not in background)