Docker Compose
Find out how to use Infisical to inject environment variables into services defined in your Docker Compose file.
Prerequisites:
- Set up and add envars to Infisical Cloud
Configure the Infisical CLI for each service
Follow this guide to configure the Infisical CLI for each service that you wish to inject environment variables into; you’ll have to update the Dockerfile of each service.
Generate and configure machine identity
Generate a machine identity for each service you want to inject secrets into. You can do this by following the steps in the Machine Identity guide.
Set the machine identity client ID and client secret as environment variables
For each service you want to inject secrets into, generate the required INFISICAL_TOKEN_SERVICE_A
and INFISICAL_TOKEN_SERVICE_B
.
Export shell variables
Next, set the shell variables you defined in your compose file. This can be done manually or via your CI/CD environment. Once done, it will be used to populate the corresponding INFISICAL_TOKEN_SERVICE_A
and INFISICAL_TOKEN_SERVICE_B
in your Docker Compose file.
Was this page helpful?