Closed nickm324 closed 2 years ago
I am very sorry that I am only now seeing your message.
I have my containers running in a Docker Compose network and for EVERYDOCS_DB_HOST I enter the name of the service where the database is running. I have not had any problems with this so far.
Therefore, I would suspect that you might use the wrong value for the database host or the database may not be accessible from another container via the specified port because the port may not be shared. According to the error message the connection to the database already fails..
Typically, the end user expects a docker image to "just work" - if your system requires a database to run, that should be pulled in automatically.
Typically, the end user expects a docker image to "just work" - if your system requires a database to run, that should be pulled in automatically.
Thank you for the comment! I'll make sure to add a docker-compose file that includes a database and everything needed to make the application running soon. When just using the Docker container, I'm not sure whether it is the right way to include a database in the same container.
Every time I try and run the container I keep getting errors. Have a MySql running in a container using BRIDGE network. It has /var/lib/mysql/mysql.sock for MYSQL_UNIX_PORT.
rake aborted! ActiveRecord::ConnectionNotEstablished: Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2) /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/mysql2_adapter.rb:53:in
rescue in new_client' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/mysql2_adapter.rb:43:in
new_client' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/mysql2_adapter.rb:23:inmysql2_connection' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:656:in
public_send' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:656:innew_connection' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:700:in
checkout_new_connection' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:679:intry_to_checkout_new_connection' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:640:in
acquire_connection' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:341:incheckout' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:181:in
connection' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/abstract/connection_handler.rb:211:inretrieve_connection' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_handling.rb:313:in
retrieve_connection' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_handling.rb:280:inconnection' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/tasks/database_tasks.rb:262:in
migrate' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/railties/databases.rake:92:inblock (2 levels) in <top (required)>' /usr/local/bundle/gems/rake-13.0.6/exe/rake:27:in
<top (required)>'Caused by: Mysql2::Error::ConnectionError: Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2) /usr/local/bundle/gems/mysql2-0.5.4/lib/mysql2/client.rb:95:in
connect' /usr/local/bundle/gems/mysql2-0.5.4/lib/mysql2/client.rb:95:in
initialize' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/mysql2_adapter.rb:44:innew' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/mysql2_adapter.rb:44:in
new_client' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/mysql2_adapter.rb:23:inmysql2_connection' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:656:in
public_send' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:656:innew_connection' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:700:in
checkout_new_connection' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:679:intry_to_checkout_new_connection' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:640:in
acquire_connection' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:341:incheckout' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:181:in
connection' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/abstract/connection_handler.rb:211:inretrieve_connection' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_handling.rb:313:in
retrieve_connection' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_handling.rb:280:inconnection' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/tasks/database_tasks.rb:262:in
migrate' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/railties/databases.rake:92:inblock (2 levels) in <top (required)>' /usr/local/bundle/gems/rake-13.0.6/exe/rake:27:in
<top (required)>' Tasks: TOP => db:migrate