skip to Main Content

Using the docker run command, I’m trying to pass my NEPTUNE_API_TOKEN to my container.

My understanding is that I should use the -e flag as follows: -e ENV_VAR='env_var_value' and that might work.
I wish, however, to use the value existing in the already-running session, as follows:

docker run -e NEPTUNE_API_TOKEN=$(NEPTUNE_API_TOKEN) <my_image>

However, after doing so, NEPTUNE_API_TOKEN is set to empty when checking the value inside the container.
My question is whether I’m doing something wrong or if this is not possible and I must provide an explicit Neptune API token as a string.

2

Answers


  1. $(NEPTUNE_API_TOKEN) is the syntax for running a command and grabbing the output. Use $NEPTUNE_API_TOKEN.

    Login or Signup to reply.
  2. You can set up and pass NEPTUNE_API_TOKEN as a:

    1. Docker run command options environment variable

    Example: docker run -e NEPTUNE_API_TOKEN="<YOUR_API_TOKEN>" <image-name>

    1. Dockerfile environment variable
    2. Docker secret

    Neptune will work with any of the methods described above.

    For your case, I believe using method 2 and 3 will work best as you will set the API token only once and all containers can reuse it. Additionally, they are more secure methods.

    You can read this guide on how to use Neptune with Docker I created last year.

    Docs: https://docs.neptune.ai/how-to-guides/automation-pipelines/how-to-use-neptune-with-docker

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search