I have two services in mine docker-compose.yml: docker-gen and nginx. Docker-gen is associated with nginx. For docker-gen to work, I have to pass the actual name or hash of the nginx container so that docker-gen can restart nginx when it changes.
When I bind docker-gen with nginx, a set of environment variables appears in the docker-gen container, the most interesting for me is NGINX_NAMEthe name of the nginx container.
Thus, it should be easy to put $NGINX_NAMEin the service field commandand make it work. But it $NGINX_NAMEdoes not expand when I start the services. Looking through the docker logs, I see the lines:
2015/04/24 12:54:27 Sending container '$NGINX_NAME' signal '1'
2015/04/24 12:54:27 Error sending signal to container: No such container: $NGINX_NAME
My docker_config.ymllooks like this:
nginx:
image: nginx:latest
ports:
- '80:80'
volumes:
- /tmp/nginx:/etc/nginx/conf.d
dockergen:
image: jwilder/docker-gen:latest
links:
- nginx
volumes_from:
- nginx
volumes:
- /var/run/docker.sock:/tmp/docker.sock
- ./extra:/etc/docker-gen/templates
- /etc/nginx/certs
tty: true
command: >
-watch
-only-exposed
-notify-sighup "$NGINX_NAME"
/etc/docker-gen/templates/nginx.tmpl
/etc/nginx/conf.d/default.conf
, , ?