EasyEnv
Engineering/Courses/Catalog/Docker/Environment Variables and Secrets
Docker
IntermediateLesson 9 of 1325 min · hands-on

Environment Variables and Secrets

Part of the Docker course

Your image works on your laptop. Now it needs to run in staging with a different database, and in production with a different one again, and the production database password must not be readable by anyone who can download the image. Building three images is obviously wrong: they would differ only in a handful of strings, and the whole promise of a container is that the artifact you tested is the artifact you ship.

So configuration has to arrive from outside the image, at the moment the container starts. Docker gives you several ways to do that, and one of them leaks secrets permanently while looking exactly like the others. ...

Want to learn Docker Environment Variables and Secrets in a real environment?

Click below, get a fresh Linux box with Docker ready to go, and work through Environment Variables and Secrets hands-on with an AI tutor that knows your code.

Start this lessonEnvironment Variables and Secrets

What you'll learn

  • ENV in Dockerfile
  • -e at run
  • Env_file in compose
  • Why not to bake secrets
  • Docker secrets brief mention

Read this lesson in your language

All lessons in this course

13 lessons
  1. 1What Is Docker20 min
  2. 2Your First Container25 min
  3. 3Images and the Dockerfile30 min
  4. 4Building Custom Images35 min
  5. 5Container Networking30 min
  6. 6Volumes and Persistence30 min
  7. 7Docker Compose35 min
  8. 8Multi-Stage Builds35 min
  9. 9Environment Variables and Secrets25 min
  10. 10Healthchecks and Restart Policies25 min
  11. 11Image Optimization and Security30 min
  12. 12Registries and Publishing25 min
  13. 13Capstone: Shipping a Stack50 min

Explore other courses

Environment Variables and Secrets - Docker (English) | Engineering Courses