teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

エラーメッセージの修正

2019/12/03 11:18

投稿

Aker
Aker

スコア15

title CHANGED
File without changes
body CHANGED
@@ -8,9 +8,8 @@
8
8
  ```
9
9
  #!/bin/bash -eo pipefail
10
10
  bundle exec rake db:create
11
- Created database 'myapp_development'
12
11
  Unknown MySQL server host 'db' (-2)
13
- Couldn't create 'myapp_test' database. Please check your configuration.
12
+ Couldn't create 'myapp_development' database. Please check your configuration.
14
13
  rake aborted!
15
14
  Mysql2::Error: Unknown MySQL server host 'db' (-2)
16
15
  /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/mysql2-0.4.10/lib/mysql2/client.rb:89:in `connect'

2

2019/12/03 11:18

投稿

Aker
Aker

スコア15

title CHANGED
File without changes
body CHANGED
@@ -4,8 +4,6 @@
4
4
  MySQL5.7
5
5
  docker-compose1.24.1
6
6
  Docker19.03.4
7
- ![イメージ説明](12ba541965891aa894edcf4f5349afc6.png)
8
- ![イメージ説明](c6033565046a25bab20262fd43cba4f6.png)
9
7
  エラーメッセージ
10
8
  ```
11
9
  #!/bin/bash -eo pipefail

1

エラーメッセージをコードに修正し、docker-compose.ymlのrailsにlinks: -dbを加えました。

2019/12/03 10:16

投稿

Aker
Aker

スコア15

title CHANGED
File without changes
body CHANGED
@@ -6,6 +6,44 @@
6
6
  Docker19.03.4
7
7
  ![イメージ説明](12ba541965891aa894edcf4f5349afc6.png)
8
8
  ![イメージ説明](c6033565046a25bab20262fd43cba4f6.png)
9
+ エラーメッセージ
10
+ ```
11
+ #!/bin/bash -eo pipefail
12
+ bundle exec rake db:create
13
+ Created database 'myapp_development'
14
+ Unknown MySQL server host 'db' (-2)
15
+ Couldn't create 'myapp_test' database. Please check your configuration.
16
+ rake aborted!
17
+ Mysql2::Error: Unknown MySQL server host 'db' (-2)
18
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/mysql2-0.4.10/lib/mysql2/client.rb:89:in `connect'
19
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/mysql2-0.4.10/lib/mysql2/client.rb:89:in `initialize'
20
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4/lib/active_record/connection_adapters/mysql2_adapter.rb:22:in `new'
21
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4/lib/active_record/connection_adapters/mysql2_adapter.rb:22:in `mysql2_connection'
22
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:830:in `new_connection'
23
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:874:in `checkout_new_connection'
24
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:853:in `try_to_checkout_new_connection'
25
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:814:in `acquire_connection'
26
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:538:in `checkout'
27
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:382:in `connection'
28
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:1033:in `retrieve_connection'
29
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4/lib/active_record/connection_handling.rb:118:in `retrieve_connection'
30
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4/lib/active_record/connection_handling.rb:90:in `connection'
31
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4/lib/active_record/tasks/mysql_database_tasks.rb:6:in `connection'
32
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4/lib/active_record/tasks/mysql_database_tasks.rb:14:in `create'
33
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4/lib/active_record/tasks/database_tasks.rb:119:in `create'
34
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4/lib/active_record/tasks/database_tasks.rb:139:in `block in create_current'
35
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4/lib/active_record/tasks/database_tasks.rb:316:in `block in each_current_configuration'
36
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4/lib/active_record/tasks/database_tasks.rb:313:in `each'
37
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4/lib/active_record/tasks/database_tasks.rb:313:in `each_current_configuration'
38
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4/lib/active_record/tasks/database_tasks.rb:138:in `create_current'
39
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4/lib/active_record/railties/databases.rake:29:in `block (2 levels) in <top (required)>'
40
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
41
+ /usr/local/bin/bundle:30:in `block in <main>'
42
+ /usr/local/bin/bundle:22:in `<main>'
43
+ Tasks: TOP => db:create
44
+ (See full trace by running task with --trace)
45
+ Exited with code 1
46
+ ```
9
47
  .circleci/config.yml
10
48
  ```
11
49
  version: 2
@@ -89,6 +127,8 @@
89
127
  - .:/myapp
90
128
  environment:
91
129
  - "SELENIUM_DRIVER_URL=http://selenium_chrome:4444/wd/hub"
130
+ links:
131
+ - db
92
132
  selenium_chrome:
93
133
  image: selenium/standalone-chrome-debug
94
134
  logging: