Reputation: 365
I try to pass env variable into my docker container and then print it
docker exec -e VAR1=1 backend echo $VAR1
But in this case I get an empty output. Why variable is not set into container?
Upvotes: 0
Views: 423
Reputation: 234
from official docker documentation.
COMMAND should be executable, a chained or a quoted command will not work. Example: docker exec -ti my_container "echo a && echo b"
will not work, but docker exec -ti my_container sh -c "echo a && echo b"
will.
https://docs.docker.com/engine/reference/commandline/exec/
Upvotes: 1