-
Notifications
You must be signed in to change notification settings - Fork 540
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
How should I link to other Docker containers? #3
Comments
I think a commit like this could help: phusion/passenger-docker@8aff974. It provides access to |
Off-topic: Am I correct in assuming that the only way to restart nginx to read new
|
Have you tried attaching to the container and running the nginx reload command? |
Yes, the issue is that nginx needs Perl support to read environment
|
You can access linked containers by hostname. See the paragraph about generated /etc/hosts in https://docs.docker.com/userguide/dockerlinks/ |
Eugene's approach is indeed better. Here's an example based on eugene's link (https://docs.docker.com/userguide/dockerlinks/) with Vagrant: config.vm.provision "docker", images: ["dockerfile/nginx", "dockerfile/elasticsearch"] do |d|
# docker run -d -p 127.0.0.1:9200:9200 -p 127.0.0.1:9300:9300 dockerfile/elasticsearch # only allows localhost connections w 127.0.0.1
d.run "dockerfile/elasticsearch", daemonize: true, args: "--name es -p 127.0.0.1:9200:9200 -p 127.0.0.1:9300:9300"
# docker run -d -p 80:80 dockerfile/nginx
d.run "dockerfile/nginx", daemonize: true, args: "--name nginx --link es:es -p 80:80 -p 443:443 -v /etc/nginx/sites-enabled:/etc/nginx/sites-enabled -v /var/log/nginx:/var/log/nginx"
end The configuration in sites-enabled:
Linked docker parent containers automatically get the child's ip populated in the |
pretty sure its at /etc/nginx/conf.d/ that the configuration needs to go |
I can link to other containers, but I cannot reference the environment variables in my
sites-enabled/
conf files. Do you know of a good way to reference your linked containers?The text was updated successfully, but these errors were encountered: