VSCode Container Support

I’m not sure how many people face this issue, but I use VSCode containers or docker containers to develop applications and write scripts for environment isolation. Up until now, I’ve been installing Doppler while building the docker image or installing it once the container is launched. However, I can’t store credentials every time I log in or use a doppler token. Thus, once the container is destroyed, the credentials are removed. Is there a way to mount a volume to store the doppler token / credentials on my host machine?
If so what path would I need to mount on my host machine?

Additionally, can Doppler release a VSCode extension to manage projects from the IDE itself?

Hi Pranav and welcome to the Doppler community!

While we don’t have official docs for VS Code yet (which I will start working on shortly), here are some tips for making it as easy as possible to work with.

Step 1. Edit your devcontainer.json file to add a containerEnv field:

{
...
    "containerEnv": {
        "DOPPLER_TOKEN": "${localEnv:DOPPLER_TOKEN}"
    },
...
}

Step 2. Exit VS Code

Step 3. Launch VS code from the terminal with the DOPPLER_TOKEN env var is set:

DOPPLER_TOKEN=$(doppler configure get token --plain) code ~/your-project-here

Step 4. VS Code should pick-up that you’ve changed the devcontainer.json and should offer to rebuild it, which you need to do.

Step 5. Now with the dev container rebuilt, you should now have the $DOPPLER_TOKEN set inside the container and can use doppler run like you would normally.

If launching VS Code using the DOPPLER_TOKEN=$(doppler configure get token --plain) code ~/your-project-here approach is a bit kludgy, here is another option which exposes the Doppler CLI token without needing to launch VS Code from the terminal.

Step 1. Expose your Doppler CLI (personal) token in your .bashrc or .bash_profile. We name this DOPPLER_CLI_TOKEN so it doesn’t affect Doppler in your local development environment.

export DOPPLER_CLI_TOKEN=$(doppler configure get token --plain) 

Step 2. Edit your devcontainer.json file to add a containerEnv field, mapping DOPPLER_TOKEN to the DOPPLER_CLI_TOKEN :

{
...
    "containerEnv": {
        "DOPPLER_TOKEN": "${localEnv:DOPPLER_CLI_TOKEN}"
    },
...
}

Let me know how this works out for you.