Share a private key

Share a private key with Docker Compose and Dotenvx.
← Back to Docker Compose

Share the encrypted .env file through git and the development key through your team's approved private channel.

$ dotenvx keypair DOTENV_PRIVATE_KEY

Your teammate saves the value in an ignored .env.keys file:

DOTENV_PRIVATE_KEY="your-shared-private-key"

They use the main compose.yaml:

$ docker compose --env-file .env.keys up --build
$ docker compose --env-file .env.keys down

Keep .env.keys out of git and Docker images. Anyone retaining the key can still decrypt the file after repository access is removed.

Open page ↗

Side path