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.
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.
Use when working with environment variables, .env files and configuration in a Laravel app - adding a new setting, APP_KEY, database/mail/queue credentials, config caching, secrets in CI/CD or Docker, or debugging "env() returns null in production". Keeps secrets out of Git and config reads cache-safe.
Use this skill when creating, modifying, or debugging Docker Compose configurations, even if the user just says they need to wire services together, add a database to their stack, or set up a local development environment with multiple containers. Covers service definitions, health checks, dependency ordering, volumes, networks, environment variables, and development overrides.
Implement secure secrets management for CI/CD pipelines using Vault, AWS Secrets Manager, or native platform solutions. Use when handling sensitive credentials, rotating secrets, or securing CI/CD environments.