0

I am trying to set environment variables in a docker container but I get the following error

 starting container process caused "exec: \"-e\": executable file not found in $PATH": unknown

Here is how I set the variables

docker run image -e ENV_VAR= '{"a":{"b":"c"}}' -p 3000:3000 

What am I missing?

1 Answer 1

3

The docker command is order sensitive. Everything after the image name is the command you want to run inside the container. Place the image name after the flags to the run command:

docker run -e ENV_VAR='{"a":{"b":"c"}}' -p 3000:3000 image 
Sign up to request clarification or add additional context in comments.

3 Comments

That gives me another error docker: invalid reference format.
@user_mda your image name is wrong, or you have something else wrong in your command. Without a real example I cannot say which.
Nevermind it works , I had an extra space in between the env variable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.