Skip to content
skillbld
Docker · 12-day planAll days
Day 9 of 12 30 min

Build one image and run it anywhere by configuring it from outside. Use environment variables, env files, ENV and build-time ARG, keep secrets out of images, run as a normal user instead of root, and limit memory and CPU.

By the end of today you can

  • Configure containers with -e and --env-file instead of rebuilding
  • Set defaults with ENV and build-time values with ARG
  • Explain why secrets must never go in a Dockerfile or image
  • Run containers as a non-root user with USER
  • Limit a container's memory and CPU

What's inside

  • 5 sections
  • 2 diagrams and mind maps
  • 6 code examples you can run
  • 5-question quiz
  1. 1Same image, different settings
  2. 2ENV and ARG in the Dockerfile
  3. 3Secrets don't belong in images
  4. 4Don't run as root
  5. 5Limiting resources

Sign in free to read this lesson

Get the full lesson with diagrams, runnable code and the quiz. Your progress is saved across devices.

Sign in free

Keep going

Day 9: Configuration & Security · Docker · SkillBld