Environment and secrets
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
supply configuration without committing secrets.
Planned topics
- Use
${VAR}incompose.yaml; values come from your shell or an.envfile. - Commit
.env.examplewith fake values; add.envto.gitignore. env_file:loads many variables into one service.- Environment variables are for local development; real secrets use a secret manager in deployed environments.
- Never commit real passwords, even "temporary" ones.
Draft outline details
Demonstration
POSTGRES_PASSWORD: ${DB_PASSWORD} with .env.example containing DB_PASSWORD=change-me.
Check your understanding
Which file is committed: .env or .env.example?
Show answer
.env.example.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.