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

Proxy sporadicly misses VIRTUAL_HOSTs #360

Closed
rwrnet opened this issue Feb 11, 2016 · 3 comments
Closed

Proxy sporadicly misses VIRTUAL_HOSTs #360

rwrnet opened this issue Feb 11, 2016 · 3 comments

Comments

@rwrnet
Copy link

rwrnet commented Feb 11, 2016

We came accross a serious issue. When starting multiple container with docker-compose, sporadicly nginx-proxy seems to miss one or more of the virtual host. In one of our environments, this happens in 3 out of 4 cases. Unfortunately, I wasn't able to reproduce the same consistent fail in a synthetic test environment. But still 1 out of 10 start ups lead to a missing host in the default.conf.

In order to demonstrate it, here is my test docker-compose.yml

proxy:
  image: jwilder/nginx-proxy
  volumes:
   - /var/run/docker.sock:/tmp/docker.sock:ro
  ports:
   - "81:80"
  environment:
   - DEFAULT_HOST=www.example.com

www1:
  image: httpd
  environment:
   - VIRTUAL_HOST=www.example.com

www2:
  image: httpd
  environment:
   - VIRTUAL_HOST=www.example.org

To observe the results I run a lookup on the proxys default.conf:

watch -n1 'docker exec -it test_proxy_1 cat /etc/nginx/conf.d/default.conf | grep proxy_pass'

while constantly starting and stopping the containers:

while true; do docker-compose stop && sleep 2 && docker-compose up -d && sleep 5; done

With some patience, you will hopefully observe ending up with just the first of the two hosts. I even observed, having had both in it at the beginning, but then one disappeared. Seems like, sometimes event handling runs into race conditions. But this is just an educated guess.

Enviroment:

# docker-compose --version
docker-compose version 1.6.0, build d99cad6
# docker --version
Docker version 1.10.0, build 590d5108
@jwilder
Copy link
Collaborator

jwilder commented Feb 11, 2016

I think this is fixed in docker-gen, but not released or incorporated into nginx-proxy yet.

Sounds similar to: nginx-proxy/docker-gen#57

Fix is here: nginx-proxy/docker-gen#156

@rwrnet
Copy link
Author

rwrnet commented Feb 12, 2016

Great. Thanks @jwilder. Looking forward to the release and will test it, once done.

@tkw1536
Copy link
Collaborator

tkw1536 commented Apr 10, 2022

Fix is merged and released, closing.

@tkw1536 tkw1536 closed this as completed Apr 10, 2022
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

3 participants