Skip to content

Accessing Secrets#

Get a Doppler SDK Token#

Secrets are managed by Doppler. Doppler's access mechanism is to use a centralized service token to retrieve all other secrets. First, you need to create a Doppler SDK token.

Set the Doppler SDK Token#

Once you have a Doppler SDK token, you can use it however you like. In our code, we usually expect a DOPPLER_SDK_TOKEN environment variable to be set. This is done by adding the token to your shell startup scripts. For convenience, we will add it to the /etc/profile file for all users on the system.

/etc/profile
...
export DOPPLER_SDK_TOKEN="<DOPPLER SERVICE TOKEN>"
...

Pass to Docker#

Docker does not have access to the /etc/profile file, so you will need to pass the DOPPLER_SDK_TOKEN environment variable to the container. This can be done with the -e flag when running the container.

docker run -e DOPPLER_SDK_TOKEN=$DOPPLER_SDK_TOKEN ...
or for a docker-compose file:

docker-compose.yml
services:
  my-service:
    environment:
      DOPPLER_SDK_TOKEN: ${DOPPLER_SDK_TOKEN}