Reputation: 7
I've got a similar problem. My Dockerfile
FROM busybox
ENV foo dev
ENV bar xyz
COPY run.sh /
ENTRYPOINT ["/bin/sh", "/run.sh"]
the run.sh file:
#!/bin/bash
echo $foo $bar
After building I run: docker run example --env "foo=Hallo Welt"
but I get the output: dev xyz
So somehow docker doesn't replace my ENV values. What am I making wrong?
Upvotes: 0
Views: 1172
Reputation: 25999
All arguments specified after the name of the image are treated as input arguments to the container, as opposed to flags to Docker.
Move the name of the image at the end of the command:
$ docker run --env "foo=Hallo Welt" example
Hallo Welt xyz
Upvotes: 3