Skip to content

Environment variables and secrets in Compose

Select an icon to see what it is.

Step 5 of 6

The program reads the file

postgres sees POSTGRES_PASSWORD_FILE and reads the password from that path when it first sets up its database. The password is not in docker inspect's Env. Many official images support a *_FILE variable for this reason.

$ docker exec shop-db-1 cat /run/secrets/db_password

Process in the container

the entrypoint reads the file and uses the value
Config.Env holds only the path, not the password