DELAPARRA
Index
Color
NL
Category: Docker

ENV

Explained by Updated

What is ENV?

ENV: Sets an environment variable baked into the image and present at runtime in every container. ENV sets an environment variable in a Docker image. It is available during the rest of the build and in every container started from the image, such as ENV APP_ENV=production. Use it for defaults that belong to the image itself, like the runtime mode or a port number. Values can still be overridden when a container starts.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about ENV

What should you keep in mind with ENV?

Do not put secrets in ENV. They become part of the image, visible to anyone who can pull it or run docker inspect. Passwords, API keys and tokens belong in environment variables set at runtime, by Compose, Kubernetes Secrets or your hosting platform. Keeping configuration outside the image also lets the same image run in test and production, which is the whole point of building it once.

What does an example of ENV look like?

ENV NODE_ENV=production \ PORT=8080

At a glance

CategoryDocker
Explained by
Updated

More Docker terms

All terms starting with E

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.