Rails docker container was killed unknowingly
up vote
-1
down vote
favorite
I am running Rails + MySQL + Redis with docker-compose up
. However, I don't know why my Rails container will be running for 30 seconds, and then be killed.
Here is my docker-compose.yml
version: '2'
services:
db:
image: mysql:5.7
restart: always
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_DATABASE=pubsub_1_development
- MYSQL_USER=appuser
- MYSQL_PASSWORD=password
ports:
- "3307:3306"
redis:
image: 'redis:4.0-alpine'
ports:
- '6379:6379'
app:
image: pubsub_1:0.0.1
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- ".:/pubsub_1"
ports:
- "3001:3000"
depends_on:
- db
- redis
links:
- db
- redis
environment:
DB_USER: root
DB_NAME: pubsub_1_development
DB_PASSWORD: password
DB_HOST: db
I notice some errors in logs, but I am not sure where to fix this problem.
app_1 | => Booting Puma
app_1 | => Rails 5.1.6 application starting in development
app_1 | => Run `rails server -h` for more startup options
app_1 | Puma starting in single mode...
app_1 | * Version 3.12.0 (ruby 2.5.1-p57), codename: Llamas in Pajamas
app_1 | * Min threads: 5, max threads: 5
app_1 | * Environment: development
app_1 | * Listening on tcp://0.0.0.0:3000
app_1 | Use Ctrl-C to stop
app_1 | Started GET "/" for 172.19.0.1 at 2018-11-09 07:47:35 +0000
app_1 | Cannot render console from 172.19.0.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
app_1 | (0.6ms) SET NAMES utf8, @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
app_1 | (0.6ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
app_1 | Processing by HomeController#index as HTML
app_1 | User Load (0.6ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1
app_1 | Rendering home/index.html.erb within layouts/application
app_1 | Event Load (0.6ms) SELECT `events`.* FROM `events` WHERE `events`.`user_id` = 1
app_1 | Rendered home/index.html.erb within layouts/application (15.4ms)
app_1 | Completed 200 OK in 1266ms (Views: 1165.0ms | ActiveRecord: 5.3ms)
app_1 |
app_1 |
app_1 | Started GET "/cable" for 172.19.0.1 at 2018-11-09 07:47:39 +0000
app_1 | Cannot render console from 172.19.0.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
app_1 | Started GET "/cable/" [WebSocket] for 172.19.0.1 at 2018-11-09 07:47:39 +0000
app_1 | Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
app_1 | User Load (1.1ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1
app_1 | Registered connection (Z2lkOi8vcHVic3ViMS9Vc2VyLzE)
app_1 | #<Thread:0x00007f2af4029e70@/usr/local/bundle/gems/actioncable-5.1.6/lib/action_cable/subscription_adapter/redis.rb:144 run> terminated with exception (report_on_exception is true):
app_1 | /usr/local/lib/ruby/2.5.0/socket.rb:1213:in `__connect_nonblock': Cannot assign requested address - connect(2) for [::1]:6379 (Errno::EADDRNOTAVAIL)
app_1 | Exiting
Here is the comprehensive log file
https://gist.github.com/fifiteen82726/308fcfd3b016f20de66e1b857d997d15
ruby-on-rails docker redis docker-compose
add a comment |
up vote
-1
down vote
favorite
I am running Rails + MySQL + Redis with docker-compose up
. However, I don't know why my Rails container will be running for 30 seconds, and then be killed.
Here is my docker-compose.yml
version: '2'
services:
db:
image: mysql:5.7
restart: always
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_DATABASE=pubsub_1_development
- MYSQL_USER=appuser
- MYSQL_PASSWORD=password
ports:
- "3307:3306"
redis:
image: 'redis:4.0-alpine'
ports:
- '6379:6379'
app:
image: pubsub_1:0.0.1
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- ".:/pubsub_1"
ports:
- "3001:3000"
depends_on:
- db
- redis
links:
- db
- redis
environment:
DB_USER: root
DB_NAME: pubsub_1_development
DB_PASSWORD: password
DB_HOST: db
I notice some errors in logs, but I am not sure where to fix this problem.
app_1 | => Booting Puma
app_1 | => Rails 5.1.6 application starting in development
app_1 | => Run `rails server -h` for more startup options
app_1 | Puma starting in single mode...
app_1 | * Version 3.12.0 (ruby 2.5.1-p57), codename: Llamas in Pajamas
app_1 | * Min threads: 5, max threads: 5
app_1 | * Environment: development
app_1 | * Listening on tcp://0.0.0.0:3000
app_1 | Use Ctrl-C to stop
app_1 | Started GET "/" for 172.19.0.1 at 2018-11-09 07:47:35 +0000
app_1 | Cannot render console from 172.19.0.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
app_1 | (0.6ms) SET NAMES utf8, @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
app_1 | (0.6ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
app_1 | Processing by HomeController#index as HTML
app_1 | User Load (0.6ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1
app_1 | Rendering home/index.html.erb within layouts/application
app_1 | Event Load (0.6ms) SELECT `events`.* FROM `events` WHERE `events`.`user_id` = 1
app_1 | Rendered home/index.html.erb within layouts/application (15.4ms)
app_1 | Completed 200 OK in 1266ms (Views: 1165.0ms | ActiveRecord: 5.3ms)
app_1 |
app_1 |
app_1 | Started GET "/cable" for 172.19.0.1 at 2018-11-09 07:47:39 +0000
app_1 | Cannot render console from 172.19.0.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
app_1 | Started GET "/cable/" [WebSocket] for 172.19.0.1 at 2018-11-09 07:47:39 +0000
app_1 | Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
app_1 | User Load (1.1ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1
app_1 | Registered connection (Z2lkOi8vcHVic3ViMS9Vc2VyLzE)
app_1 | #<Thread:0x00007f2af4029e70@/usr/local/bundle/gems/actioncable-5.1.6/lib/action_cable/subscription_adapter/redis.rb:144 run> terminated with exception (report_on_exception is true):
app_1 | /usr/local/lib/ruby/2.5.0/socket.rb:1213:in `__connect_nonblock': Cannot assign requested address - connect(2) for [::1]:6379 (Errno::EADDRNOTAVAIL)
app_1 | Exiting
Here is the comprehensive log file
https://gist.github.com/fifiteen82726/308fcfd3b016f20de66e1b857d997d15
ruby-on-rails docker redis docker-compose
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I am running Rails + MySQL + Redis with docker-compose up
. However, I don't know why my Rails container will be running for 30 seconds, and then be killed.
Here is my docker-compose.yml
version: '2'
services:
db:
image: mysql:5.7
restart: always
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_DATABASE=pubsub_1_development
- MYSQL_USER=appuser
- MYSQL_PASSWORD=password
ports:
- "3307:3306"
redis:
image: 'redis:4.0-alpine'
ports:
- '6379:6379'
app:
image: pubsub_1:0.0.1
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- ".:/pubsub_1"
ports:
- "3001:3000"
depends_on:
- db
- redis
links:
- db
- redis
environment:
DB_USER: root
DB_NAME: pubsub_1_development
DB_PASSWORD: password
DB_HOST: db
I notice some errors in logs, but I am not sure where to fix this problem.
app_1 | => Booting Puma
app_1 | => Rails 5.1.6 application starting in development
app_1 | => Run `rails server -h` for more startup options
app_1 | Puma starting in single mode...
app_1 | * Version 3.12.0 (ruby 2.5.1-p57), codename: Llamas in Pajamas
app_1 | * Min threads: 5, max threads: 5
app_1 | * Environment: development
app_1 | * Listening on tcp://0.0.0.0:3000
app_1 | Use Ctrl-C to stop
app_1 | Started GET "/" for 172.19.0.1 at 2018-11-09 07:47:35 +0000
app_1 | Cannot render console from 172.19.0.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
app_1 | (0.6ms) SET NAMES utf8, @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
app_1 | (0.6ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
app_1 | Processing by HomeController#index as HTML
app_1 | User Load (0.6ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1
app_1 | Rendering home/index.html.erb within layouts/application
app_1 | Event Load (0.6ms) SELECT `events`.* FROM `events` WHERE `events`.`user_id` = 1
app_1 | Rendered home/index.html.erb within layouts/application (15.4ms)
app_1 | Completed 200 OK in 1266ms (Views: 1165.0ms | ActiveRecord: 5.3ms)
app_1 |
app_1 |
app_1 | Started GET "/cable" for 172.19.0.1 at 2018-11-09 07:47:39 +0000
app_1 | Cannot render console from 172.19.0.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
app_1 | Started GET "/cable/" [WebSocket] for 172.19.0.1 at 2018-11-09 07:47:39 +0000
app_1 | Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
app_1 | User Load (1.1ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1
app_1 | Registered connection (Z2lkOi8vcHVic3ViMS9Vc2VyLzE)
app_1 | #<Thread:0x00007f2af4029e70@/usr/local/bundle/gems/actioncable-5.1.6/lib/action_cable/subscription_adapter/redis.rb:144 run> terminated with exception (report_on_exception is true):
app_1 | /usr/local/lib/ruby/2.5.0/socket.rb:1213:in `__connect_nonblock': Cannot assign requested address - connect(2) for [::1]:6379 (Errno::EADDRNOTAVAIL)
app_1 | Exiting
Here is the comprehensive log file
https://gist.github.com/fifiteen82726/308fcfd3b016f20de66e1b857d997d15
ruby-on-rails docker redis docker-compose
I am running Rails + MySQL + Redis with docker-compose up
. However, I don't know why my Rails container will be running for 30 seconds, and then be killed.
Here is my docker-compose.yml
version: '2'
services:
db:
image: mysql:5.7
restart: always
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_DATABASE=pubsub_1_development
- MYSQL_USER=appuser
- MYSQL_PASSWORD=password
ports:
- "3307:3306"
redis:
image: 'redis:4.0-alpine'
ports:
- '6379:6379'
app:
image: pubsub_1:0.0.1
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- ".:/pubsub_1"
ports:
- "3001:3000"
depends_on:
- db
- redis
links:
- db
- redis
environment:
DB_USER: root
DB_NAME: pubsub_1_development
DB_PASSWORD: password
DB_HOST: db
I notice some errors in logs, but I am not sure where to fix this problem.
app_1 | => Booting Puma
app_1 | => Rails 5.1.6 application starting in development
app_1 | => Run `rails server -h` for more startup options
app_1 | Puma starting in single mode...
app_1 | * Version 3.12.0 (ruby 2.5.1-p57), codename: Llamas in Pajamas
app_1 | * Min threads: 5, max threads: 5
app_1 | * Environment: development
app_1 | * Listening on tcp://0.0.0.0:3000
app_1 | Use Ctrl-C to stop
app_1 | Started GET "/" for 172.19.0.1 at 2018-11-09 07:47:35 +0000
app_1 | Cannot render console from 172.19.0.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
app_1 | (0.6ms) SET NAMES utf8, @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
app_1 | (0.6ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
app_1 | Processing by HomeController#index as HTML
app_1 | User Load (0.6ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1
app_1 | Rendering home/index.html.erb within layouts/application
app_1 | Event Load (0.6ms) SELECT `events`.* FROM `events` WHERE `events`.`user_id` = 1
app_1 | Rendered home/index.html.erb within layouts/application (15.4ms)
app_1 | Completed 200 OK in 1266ms (Views: 1165.0ms | ActiveRecord: 5.3ms)
app_1 |
app_1 |
app_1 | Started GET "/cable" for 172.19.0.1 at 2018-11-09 07:47:39 +0000
app_1 | Cannot render console from 172.19.0.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
app_1 | Started GET "/cable/" [WebSocket] for 172.19.0.1 at 2018-11-09 07:47:39 +0000
app_1 | Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
app_1 | User Load (1.1ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1
app_1 | Registered connection (Z2lkOi8vcHVic3ViMS9Vc2VyLzE)
app_1 | #<Thread:0x00007f2af4029e70@/usr/local/bundle/gems/actioncable-5.1.6/lib/action_cable/subscription_adapter/redis.rb:144 run> terminated with exception (report_on_exception is true):
app_1 | /usr/local/lib/ruby/2.5.0/socket.rb:1213:in `__connect_nonblock': Cannot assign requested address - connect(2) for [::1]:6379 (Errno::EADDRNOTAVAIL)
app_1 | Exiting
Here is the comprehensive log file
https://gist.github.com/fifiteen82726/308fcfd3b016f20de66e1b857d997d15
ruby-on-rails docker redis docker-compose
ruby-on-rails docker redis docker-compose
asked Nov 9 at 8:07
Coda Chang
1,56721940
1,56721940
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
Looks like your Rails App is trying to connect to Redis on the localhost
where Redis is not available. And seems like this causes the whole app service to stop. Instead of localhost
, it should use the hostname redis
for Redis in the config of the app.
I know it seems to look for the right path ofredis
, but I don't understand your last sentence. "it should use the hostname redis for Redis in the config of the app." what is that mean?
– Coda Chang
Nov 10 at 2:56
Oh, I understand what you mean. After I change my setting fromredis://localhost:6379/1
toredis://redis:6379/1
, it works. Thanks!
– Coda Chang
Nov 10 at 3:02
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
Looks like your Rails App is trying to connect to Redis on the localhost
where Redis is not available. And seems like this causes the whole app service to stop. Instead of localhost
, it should use the hostname redis
for Redis in the config of the app.
I know it seems to look for the right path ofredis
, but I don't understand your last sentence. "it should use the hostname redis for Redis in the config of the app." what is that mean?
– Coda Chang
Nov 10 at 2:56
Oh, I understand what you mean. After I change my setting fromredis://localhost:6379/1
toredis://redis:6379/1
, it works. Thanks!
– Coda Chang
Nov 10 at 3:02
add a comment |
up vote
0
down vote
accepted
Looks like your Rails App is trying to connect to Redis on the localhost
where Redis is not available. And seems like this causes the whole app service to stop. Instead of localhost
, it should use the hostname redis
for Redis in the config of the app.
I know it seems to look for the right path ofredis
, but I don't understand your last sentence. "it should use the hostname redis for Redis in the config of the app." what is that mean?
– Coda Chang
Nov 10 at 2:56
Oh, I understand what you mean. After I change my setting fromredis://localhost:6379/1
toredis://redis:6379/1
, it works. Thanks!
– Coda Chang
Nov 10 at 3:02
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
Looks like your Rails App is trying to connect to Redis on the localhost
where Redis is not available. And seems like this causes the whole app service to stop. Instead of localhost
, it should use the hostname redis
for Redis in the config of the app.
Looks like your Rails App is trying to connect to Redis on the localhost
where Redis is not available. And seems like this causes the whole app service to stop. Instead of localhost
, it should use the hostname redis
for Redis in the config of the app.
answered Nov 9 at 12:34
Uku Loskit
29.5k76779
29.5k76779
I know it seems to look for the right path ofredis
, but I don't understand your last sentence. "it should use the hostname redis for Redis in the config of the app." what is that mean?
– Coda Chang
Nov 10 at 2:56
Oh, I understand what you mean. After I change my setting fromredis://localhost:6379/1
toredis://redis:6379/1
, it works. Thanks!
– Coda Chang
Nov 10 at 3:02
add a comment |
I know it seems to look for the right path ofredis
, but I don't understand your last sentence. "it should use the hostname redis for Redis in the config of the app." what is that mean?
– Coda Chang
Nov 10 at 2:56
Oh, I understand what you mean. After I change my setting fromredis://localhost:6379/1
toredis://redis:6379/1
, it works. Thanks!
– Coda Chang
Nov 10 at 3:02
I know it seems to look for the right path of
redis
, but I don't understand your last sentence. "it should use the hostname redis for Redis in the config of the app." what is that mean?– Coda Chang
Nov 10 at 2:56
I know it seems to look for the right path of
redis
, but I don't understand your last sentence. "it should use the hostname redis for Redis in the config of the app." what is that mean?– Coda Chang
Nov 10 at 2:56
Oh, I understand what you mean. After I change my setting from
redis://localhost:6379/1
to redis://redis:6379/1
, it works. Thanks!– Coda Chang
Nov 10 at 3:02
Oh, I understand what you mean. After I change my setting from
redis://localhost:6379/1
to redis://redis:6379/1
, it works. Thanks!– Coda Chang
Nov 10 at 3:02
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53221914%2frails-docker-container-was-killed-unknowingly%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown