Skip to content

Connection timeout with nodejs app occasionally #52

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

Closed
Globegitter opened this issue Mar 4, 2015 · 7 comments · Fixed by #89
Closed

Connection timeout with nodejs app occasionally #52

Globegitter opened this issue Mar 4, 2015 · 7 comments · Fixed by #89

Comments

@Globegitter
Copy link

I am using docker-compose to connect a nodejs app to a mysql database with the following .yml file:

db:
  image: mysql
  ports:
    - "3306:3306"
  environment:
    - MYSQL_ROOT_PASSWORD=password
    - MYSQL_DATABASE=sane
server:
  image: artificial/docker-sails:iojs-full-stable-pm2
  command: sails lift --verbose
  volumes:
    - server/:/server
  ports:
    - "1337:1337"
  links:
    - db

Often it works, but often I get a timeout and a warning '2015-03-04 14:40:37 1 [Warning] IP address '172.17.0.15' could not be resolved: Temporary failure in name resolution' I am not entirely sure if the issue is here, or in the app itself, since if I switch to the postgresql I have no issues as well.

Still trying to nail down where exactly the issue arises, this is more to keep track of it in case it is an issue with the image being slow or something.

@RobLoach
Copy link

Looks like you're trying to link the db to the same host. links should point to other container you want to connect to:
https://docs.docker.com/compose/yml/#links

@Globegitter
Copy link
Author

@RobLoach Sorry could you clarify? Does that not link db to server? The connection does work occasionally and then it saves everything properly to the db, etc.

@RobLoach
Copy link

Specify links for connections that you want to make from one container to the other. Seems strange to specify a link from one container to itself.

db:
  links:
    - db

@Globegitter
Copy link
Author

In the example above it states:

server:
  links:
    - db   

As far as I can see that is exactly what you say - from one container to another. I think compose might even throw an error if you link a container to itself.

@RobLoach
Copy link

Oh wow, my eyes fail me.... 👍 .

@chris-redfield
Copy link

Bump... Plz fix guys =p

@yosifkit
Copy link
Member

Doh, I should have realized earlier that this is just mysql trying to do reverse DNS lookups.... https://serverfault.com/questions/341290/mysql-warning-ip-address-could-not-be-resolved. We just need those lines in the config.

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

Successfully merging a pull request may close this issue.

4 participants