Update docker integration

This commit is contained in:
Maidul Islam
2023-01-22 12:50:06 -08:00
parent 4db4c172c1
commit 4b4e8e2bfc
+16 -14
View File
@@ -31,25 +31,22 @@ Infisical can be used in a Dockerfile to inject environment variables into a Doc
</Tab> </Tab>
</Tabs> </Tabs>
## Modify the start command in your Dockerfile ## Modify your Dockerfile start command
To make your Docker container consume Infisical secrets, you can start your application with Infisical.
This will automatically pull the necessary secrets and make them available to your application as if they were natively exposed within the container.
```dockerfile ```dockerfile
CMD ["infisical", "--env=[env]", "projectId=[projectId]", "run", "---", "[your application start command]"] CMD ["infisical", "run", "---", "[your application start command]"]
# example # example with single single command
CMD ["infisical", "--env=prod", "projectId=62faf98ae0b05e83239b5da41", "run", "---", "npm run start"] CMD ["infisical", "run", "---", "npm run start"]
# example with multiple commands
CMD ["infisical", "run", "--command" "npm run start && ..."]
``` ```
Required options: View more options for the `run` command [here](../../cli/commands/run)
| Option | Description | Default value |
| ------------- | ----------------------------------------------------------------------------------------------------------- | ------------- |
| `--env` | Used to set the environment that secrets are pulled from. Accepted values: `dev`, `staging`, `test`, `prod` | `dev` |
| `--projectId` | Used to link a local project to the platform | `None` |
## Generate an Infisical Token
[Generate an Infisical Token](../../getting-started/dashboard/token) and keep it handy.
## Feed Docker your Infisical Token ## Feed Docker your Infisical Token
@@ -58,3 +55,8 @@ The CLI looks out for an environment variable called `INFISICAL_TOKEN`. If the t
```bash ```bash
docker run --env INFISICAL_TOKEN=[token]... docker run --env INFISICAL_TOKEN=[token]...
``` ```
## Generate an Infisical Token
[Generate an Infisical Token](../../getting-started/dashboard/token) and keep it handy.