Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-compose environment variables not respected #298

Open
CarlHostetter-NASA opened this issue Dec 19, 2018 · 0 comments
Open

docker-compose environment variables not respected #298

CarlHostetter-NASA opened this issue Dec 19, 2018 · 0 comments

Comments

@CarlHostetter-NASA
Copy link

CarlHostetter-NASA commented Dec 19, 2018

It appears that the docker-gen container does not "see" or respect environment variables set by docker-compose. Here is my docker-gen service:

docker-gen:
    image: jwilder/docker-gen
    container_name: docker-gen
    command: -notify-sighup nginx-proxy -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
    depends_on:
        - nginx-proxy
    volumes:
        - ../certs:/etc/nginx/certs:ro
        - ./docker-gen/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl
        - /var/run/docker.sock:/tmp/docker.sock
        - nginx-proxy-conf:/etc/nginx/conf.d
        - nginx-proxy-vhosts:/etc/nginx/vhost.d
    environment:
        - DEFAULT_HOST=foo.bar
        - FOO=bar

However, neither FOO nor (more importantly) DEFAULT_HOST are respected as environment variables within the docker-gen container.

This in turn causes the default_server option not to be set when generating default.conf from the nginx.tmpl of nginx-proxy:

{ $default_host := or ($.Env.DEFAULT_HOST) "" }}
{{ $default_server := index (dict $host "" $default_host "default_server") $host }}

...

server {
server_name {{ $host }};
listen 443 ssl http2 {{ $default_server }};

and I need that to be set for proper security.

Please help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant