You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure if this is the right repo to post this to but I figured I'd start here and perhaps someone can at least point me in the right direction. I have a docker-compose.test.yml file which creates two services (web and db). Here is said file:
The problem that I'm running into is when I perform an up and then a run that attempts to connect to the db service I get the following error:
Mysql2::Error: Can't connect to MySQL server on 'db' (111)
What's odd is that if I run the up and then wait ~30 seconds and then run everything works as expected. It appears that my networking isn't getting linked up or something. Has anyone else run into this problem?
docker-compose version: docker-compose version 1.9.0-rc2, build a2da43b docker version: Docker version 1.12.3, build 6b644ec, experimental
Doesn't Work
docker-compose -f docker-compose.test.yml -p rfc_test up --build --remove-orphans -d
# immediately after this completes call
docker-compose -f docker-compose.test.yml -p rfc_test run --rm web rake db:schema:load
[DEPRECATION] `last_comment` is deprecated. Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated. Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated. Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated. Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated. Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated. Please use `last_description` instead.
-- create_table("attachments", {:force=>:cascade})
rake aborted!
Mysql2::Error: Can't connect to MySQL server on 'db' (111)
...
Works
docker-compose -f docker-compose.test.yml -p rfc_test up --build --remove-orphans -d
# wait ~30 seconds
docker-compose -f docker-compose.test.yml -p rfc_test run --rm web rake db:schema:load
[DEPRECATION] `last_comment` is deprecated. Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated. Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated. Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated. Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated. Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated. Please use `last_description` instead.
-- create_table("attachments", {:force=>:cascade})
-> 0.1204s
...
The text was updated successfully, but these errors were encountered:
MySQL needs time to start up, and there's a latency until it starts answering on the allocated port. This has nothing to do with docker - you need to implement some sort of retry mechanism into your workflow to account for it.
You can use a tool such as wait-for-it, dockerize or sh-compatible wait-for. These are small wrapper scripts which you can include in your application’s image and will poll a given host and port until it’s accepting TCP connections.
Hi All,
I'm not sure if this is the right repo to post this to but I figured I'd start here and perhaps someone can at least point me in the right direction. I have a
docker-compose.test.yml
file which creates two services (web
anddb
). Here is said file:The problem that I'm running into is when I perform an
up
and then arun
that attempts to connect to thedb
service I get the following error:What's odd is that if I run the
up
and then wait ~30 seconds and thenrun
everything works as expected. It appears that my networking isn't getting linked up or something. Has anyone else run into this problem?docker-compose version: docker-compose version 1.9.0-rc2, build a2da43b
docker version: Docker version 1.12.3, build 6b644ec, experimental
Doesn't Work
Works
The text was updated successfully, but these errors were encountered: