codegurukool.com · Free coding tutorials & online compiler

Home › Docker Tutorial › Environment variables

Environment variables

Configure containers without rebuilding.

Pass settings with -e NAME=value or load many from a file with --env-file. In a Dockerfile, ENV sets a default and ARG is a value used only while building. Never bake passwords into an image.

Example code

docker run --rm -e GREETING=Hello busybox sh -c 'echo $GREETING World'

Run this code in the online editor

← NetworksDocker Compose →