I have a Dockerfile and I'd like to make the API configurable with a default value.
FROM socialengine/nginx-spa
ENV API_URL localhost:6007
So when I run this image I'd to be able to override the localhost:6007 with something like below:
docker run -e API_URL=production.com:6007 ui
This doesn't work and I can't find a clear explanation of how to do this.
Any advice?
What you have described should work just fine. Given:
Consider this:
Compared to:
Passing a
-e VARNAME=varvalue
on thedocker run
command line will override a default set in your Dockerfile.If you are seeing different behavior, please update your question to show exactly the command you are running and the associated output.
Update
Here is the complete example, recorded for your viewing pleasure:
https://asciinema.org/a/a5a2n3exlyh4jkii4k0ivvqmd