user_mda
user_mda

Reputation: 19388

Setting environment variable in a docker container

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?

Upvotes: 0

Views: 2043

Answers (1)

BMitch
BMitch

Reputation: 263666

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 

Upvotes: 3

Related Questions