ENV

The Dockerfile instruction that sets an environment variable in the image, visible during the build and in every container.

Values are stored in the image and visible to anyone who can pull it.

In more detail

ENV PORT=8000 bakes a default into the image; docker run -e PORT=9000 overrides it at run time. Anything set with ENV is readable by anyone with the image, so it is for configuration, never for secrets.

Example

ENV PYTHONUNBUFFERED=1

Related terms

Taught in

References

Certification courses