nginx base image which can use environment variables in nginx config files
1.7K
Create a new docker file
FROM martin/nginx
Place nginx site config file in directory ./conf, these will be placed in /etc/nginx/conf.d/. the config file should have server root set to /app/ root /app/;
Place html files in directory "./app", this will be your main site
docker build -t mynew/nginx .
docker run -d mynew/nginx
Config files may contain environment variables in the form of $ENV{"environmentvariablename"}. These will be replaced when the container starts.
So if you link another container docker run -d --link myservicecontainer mynew/nginx
server {
listen 80;
root /app/;
index index.html;
location /myservice {
proxy_pass http://myservice_backend;
}
}
upstream myservice_backend {
server myservicecontainer:$ENV{"MYSERVICECONTAINER_PORT_1234_TCP_PORT"};
keepalive 4;
}
Content type
Image
Digest
sha256:fc3723fb8…
Size
48.3 MB
Last updated
about 7 years ago
docker pull martin/nginx