質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.35%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails 6

Ruby on Rails 6は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Docker

Dockerは、Docker社が開発したオープンソースのコンテナー管理ソフトウェアの1つです

Q&A

解決済

1回答

1214閲覧

Dockerでのrails環境構築について

bababa

総合スコア10

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails 6

Ruby on Rails 6は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Docker

Dockerは、Docker社が開発したオープンソースのコンテナー管理ソフトウェアの1つです

0グッド

0クリップ

投稿2020/06/01 08:22

こちらの記事を参考にして、 Dockerでrailsの環境構築を行いました。
https://qiita.com/azul915/items/5b7063cbc80192343fc0

先週行った時は、エラーも出ず無事成功しましたが
今回改めて行ったところ、

ActiveRecord::ConnectionNotEstablished

1 No connection pool with 'primary' found.

というエラーに遭遇しました。

ターミナル上では、エラーになる瞬間に以下文章が追加されます。

web_1 | 2020-06-01 08:03:18 +0000: Rack app error handling request { GET / }
web_1 | #<ActiveRecord::AdapterNotSpecified: 'development' database is not configured. Available: ["default"]>
web_1 | /usr/local/bundle/gems/activerecord-5.2.4.3/lib/active_record/connection_adapters/connection_specification.rb:260:in resolve_symbol_connection' web_1 | /usr/local/bundle/gems/activerecord-5.2.4.3/lib/active_record/connection_adapters/connection_specification.rb:241:in resolve_connection'
web_1 | /usr/local/bundle/gems/activerecord-5.2.4.3/lib/active_record/connection_adapters/connection_specification.rb:143:in resolve' web_1 | /usr/local/bundle/gems/activerecord-5.2.4.3/lib/active_record/connection_handling.rb:57:in establish_connection'
web_1 | /usr/local/bundle/gems/activerecord-5.2.4.3/lib/active_record/railtie.rb:136:in block (2 levels) in <class:Railtie>' web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/lazy_load_hooks.rb:71:in instance_eval'
web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/lazy_load_hooks.rb:71:in block in execute_hook' web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/lazy_load_hooks.rb:62:in with_execution_control'
web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/lazy_load_hooks.rb:67:in execute_hook' web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/lazy_load_hooks.rb:52:in block in run_load_hooks'
web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/lazy_load_hooks.rb:51:in each' web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/lazy_load_hooks.rb:51:in run_load_hooks'
web_1 | /usr/local/bundle/gems/activerecord-5.2.4.3/lib/active_record/base.rb:328:in <module:ActiveRecord>' web_1 | /usr/local/bundle/gems/activerecord-5.2.4.3/lib/active_record/base.rb:27:in <top (required)>'
web_1 | /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require' web_1 | /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in block in require_with_bootsnap_lfi'
web_1 | /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in register' web_1 | /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in require_with_bootsnap_lfi'
web_1 | /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in require' web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in block in require'
web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:257:in load_dependency' web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in require'
web_1 | /usr/local/bundle/gems/activerecord-5.2.4.3/lib/active_record/query_cache.rb:29:in run' web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/execution_wrapper.rb:27:in before'
web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/callbacks.rb:426:in block in make_lambda' web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/callbacks.rb:198:in block (2 levels) in halting'
web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/callbacks.rb:606:in block (2 levels) in default_terminator' web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/callbacks.rb:605:in catch'
web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/callbacks.rb:605:in block in default_terminator' web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/callbacks.rb:199:in block in halting'
web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/callbacks.rb:513:in block in invoke_before' web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/callbacks.rb:513:in each'
web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/callbacks.rb:513:in invoke_before' web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/callbacks.rb:131:in run_callbacks'
web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/execution_wrapper.rb:110:in run!' web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/execution_wrapper.rb:72:in block in run!'
web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/execution_wrapper.rb:69:in tap' web_1 | /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/execution_wrapper.rb:69:in run!'
web_1 | /usr/local/bundle/gems/actionpack-5.2.4.3/lib/action_dispatch/middleware/executor.rb:12:in call' web_1 | /usr/local/bundle/gems/actionpack-5.2.4.3/lib/action_dispatch/middleware/static.rb:127:in call'
web_1 | /usr/local/bundle/gems/rack-2.2.2/lib/rack/sendfile.rb:110:in call' web_1 | /usr/local/bundle/gems/railties-5.2.4.3/lib/rails/engine.rb:524:in call'
web_1 | /usr/local/bundle/gems/puma-3.12.6/lib/puma/configuration.rb:227:in call' web_1 | /usr/local/bundle/gems/puma-3.12.6/lib/puma/server.rb:706:in handle_request'
web_1 | /usr/local/bundle/gems/puma-3.12.6/lib/puma/server.rb:476:in process_client' web_1 | /usr/local/bundle/gems/puma-3.12.6/lib/puma/server.rb:334:in block in run'
web_1 | /usr/local/bundle/gems/puma-3.12.6/lib/puma/thread_pool.rb:135:in block in spawn_thread' web_1 | => Booting Puma web_1 | => Rails 5.2.4.3 application starting in development web_1 | => Run rails server -hfor more startup options web_1 | Puma starting in single mode... web_1 | * Version 3.12.6 (ruby 2.5.3-p105), codename: Llamas in Pajamas web_1 | * Min threads: 5, max threads: 5 web_1 | * Environment: development web_1 | * Listening on tcp://0.0.0.0:3000 web_1 | Use Ctrl-C to stop web_1 | Started GET "/" for 172.22.0.1 at 2020-06-01 08:03:42 +0000 web_1 | Cannot render console from 172.22.0.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255 web_1 | web_1 | ActiveRecord::ConnectionNotEstablished (No connection pool with 'primary' found.): web_1 | web_1 | activerecord (5.2.4.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:1032:inretrieve_connection'
web_1 | activerecord (5.2.4.3) lib/active_record/connection_handling.rb:118:in retrieve_connection' web_1 | activerecord (5.2.4.3) lib/active_record/connection_handling.rb:90:in connection'
web_1 | activerecord (5.2.4.3) lib/active_record/migration.rb:554:in call' web_1 | actionpack (5.2.4.3) lib/action_dispatch/middleware/callbacks.rb:28:in block in call'
web_1 | activesupport (5.2.4.3) lib/active_support/callbacks.rb:98:in run_callbacks' web_1 | actionpack (5.2.4.3) lib/action_dispatch/middleware/callbacks.rb:26:in call'
web_1 | actionpack (5.2.4.3) lib/action_dispatch/middleware/executor.rb:14:in call' web_1 | actionpack (5.2.4.3) lib/action_dispatch/middleware/debug_exceptions.rb:61:in call'
web_1 | web-console (3.7.0) lib/web_console/middleware.rb:135:in call_app' web_1 | web-console (3.7.0) lib/web_console/middleware.rb:22:in block in call'
web_1 | web-console (3.7.0) lib/web_console/middleware.rb:20:in catch' web_1 | web-console (3.7.0) lib/web_console/middleware.rb:20:in call'
web_1 | actionpack (5.2.4.3) lib/action_dispatch/middleware/show_exceptions.rb:33:in call' web_1 | railties (5.2.4.3) lib/rails/rack/logger.rb:38:in call_app'
web_1 | railties (5.2.4.3) lib/rails/rack/logger.rb:26:in block in call' web_1 | activesupport (5.2.4.3) lib/active_support/tagged_logging.rb:71:in block in tagged'
web_1 | activesupport (5.2.4.3) lib/active_support/tagged_logging.rb:28:in tagged' web_1 | activesupport (5.2.4.3) lib/active_support/tagged_logging.rb:71:in tagged'
web_1 | railties (5.2.4.3) lib/rails/rack/logger.rb:26:in call' web_1 | sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in call'
web_1 | actionpack (5.2.4.3) lib/action_dispatch/middleware/remote_ip.rb:81:in call' web_1 | actionpack (5.2.4.3) lib/action_dispatch/middleware/request_id.rb:27:in call'
web_1 | rack (2.2.2) lib/rack/method_override.rb:24:in call' web_1 | rack (2.2.2) lib/rack/runtime.rb:22:in call'
web_1 | activesupport (5.2.4.3) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in call' web_1 | actionpack (5.2.4.3) lib/action_dispatch/middleware/executor.rb:14:in call'
web_1 | actionpack (5.2.4.3) lib/action_dispatch/middleware/static.rb:127:in call' web_1 | rack (2.2.2) lib/rack/sendfile.rb:110:in call'
web_1 | railties (5.2.4.3) lib/rails/engine.rb:524:in call' web_1 | puma (3.12.6) lib/puma/configuration.rb:227:in call'
web_1 | puma (3.12.6) lib/puma/server.rb:706:in handle_request' web_1 | puma (3.12.6) lib/puma/server.rb:476:in process_client'
web_1 | puma (3.12.6) lib/puma/server.rb:334:in block in run' web_1 | puma (3.12.6) lib/puma/thread_pool.rb:135:in block in spawn_thread'

先週からDockerを学び始めましたが、よくわかっておりません。
もしよろしければ、アドバイスいただければ恐縮です。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

もう一度作り直したら解決しました。おそらくgemのversionの問題ですが、再度rails環境構築を行った際は
database.ymlのところでエラーが出たので、developmentを追加したところ無事解決しました!

投稿2020/06/02 01:13

bababa

総合スコア10

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.35%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問