.env
files. You should first define the encrypted secrets in
the Phala Cloud UI (or CLI), and then reference them in the docker compose file using the ${KEY}
syntax.
A typical use case is to pass secrets to your containers via environment variables, using the
environment:
docker compose directive.
-
Declare Environment Variables in Docker Compose
Define your environment variables in the Docker Compose file using variable substitution:
Important: Do not use double quotation marks around variables:
❌OPENAI_API_KEY="${OPENAI_API_KEY_IN_ENV}"
- Set Values in Encrypted Secrets Configure the actual values in the Encrypted Secrets section of the Phala Cloud UI.

Encrypted Secrets configuration interface
The encrypted secrets don’t have to be defined in the same name as the environment variables in the
docker compose file. You can define them in the UI with any name you want, and then reference them
in the docker compose file using the
${KEY}
syntax.Besides the environment variables, you can also reference the encrypted secrets in any other place
like the command:
docker compose directive. However, you should be careful to not leak the secret
values in the logs or other places.Learn more about Docker .env files here.