Skip to content

安装postgresql报错,请帮忙解决 #53

Open
@ghost

Description

  • 系统环境
Centos8
Docker version 19.03.8, build afacb8b
  • 报错
Status: Downloaded newer image for homeland/homeland:latest
=> Booting Homeland
=> Plugins: 
could not connect to server: Host is unreachable
	Is the server running on host "postgresql" (172.18.0.3) and accepting
	TCP/IP connections on port 5432?
Couldn't create 'homeland' database. Please check your configuration.
rails aborted!
ActiveRecord::NoDatabaseError: could not connect to server: Host is unreachable
	Is the server running on host "postgresql" (172.18.0.3) and accepting
	TCP/IP connections on port 5432?
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:50:in `rescue in postgresql_connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:33:in `postgresql_connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:887:in `new_connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `checkout_new_connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:910:in `try_to_checkout_new_connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:871:in `acquire_connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:593:in `checkout'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:437:in `connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1119:in `retrieve_connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_handling.rb:221:in `retrieve_connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_handling.rb:189:in `connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/tasks/postgresql_database_tasks.rb:12:in `connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/tasks/postgresql_database_tasks.rb:21:in `create'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/tasks/database_tasks.rb:126:in `create'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/tasks/database_tasks.rb:185:in `block in create_current'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/tasks/database_tasks.rb:479:in `block (2 levels) in each_current_configuration'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/tasks/database_tasks.rb:476:in `each'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/tasks/database_tasks.rb:476:in `block in each_current_configuration'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/tasks/database_tasks.rb:475:in `each'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/tasks/database_tasks.rb:475:in `each_current_configuration'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/tasks/database_tasks.rb:184:in `create_current'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/railties/databases.rake:39:in `block (2 levels) in <main>'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/railties-6.0.3/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/railties-6.0.3/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/railties-6.0.3/lib/rails/command.rb:48:in `invoke'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/railties-6.0.3/lib/rails/commands.rb:18:in `<main>'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:324:in `block in require'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:291:in `load_dependency'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:324:in `require'
bin/rails:4:in `<main>'

Caused by:
PG::ConnectionBad: could not connect to server: Host is unreachable
	Is the server running on host "postgresql" (172.18.0.3) and accepting
	TCP/IP connections on port 5432?
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/pg-1.2.3/lib/pg.rb:58:in `initialize'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/pg-1.2.3/lib/pg.rb:58:in `new'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/pg-1.2.3/lib/pg.rb:58:in `connect'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:46:in `postgresql_connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:887:in `new_connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `checkout_new_connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:910:in `try_to_checkout_new_connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:871:in `acquire_connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:593:in `checkout'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:437:in `connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1119:in `retrieve_connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_handling.rb:221:in `retrieve_connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/connection_handling.rb:189:in `connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/tasks/postgresql_database_tasks.rb:12:in `connection'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/tasks/postgresql_database_tasks.rb:21:in `create'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/tasks/database_tasks.rb:126:in `create'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/tasks/database_tasks.rb:185:in `block in create_current'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/tasks/database_tasks.rb:479:in `block (2 levels) in each_current_configuration'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/tasks/database_tasks.rb:476:in `each'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/tasks/database_tasks.rb:476:in `block in each_current_configuration'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/tasks/database_tasks.rb:475:in `each'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/tasks/database_tasks.rb:475:in `each_current_configuration'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/tasks/database_tasks.rb:184:in `create_current'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3/lib/active_record/railties/databases.rake:39:in `block (2 levels) in <main>'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/railties-6.0.3/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/railties-6.0.3/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/railties-6.0.3/lib/rails/command.rb:48:in `invoke'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/railties-6.0.3/lib/rails/commands.rb:18:in `<main>'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:324:in `block in require'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:291:in `load_dependency'
/home/app/homeland/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:324:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:create
(See full trace by running task with --trace)
make: *** [Makefile:10: install] Error 1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions