PG :: ConnectionBad:无法将主机名“ postgres”转换为地址:没有与主机名关联的地址

问题描述

在终端sudo docker-compose run --rm网站rake db:create中运行后,出现此错误:rake已中止! PG :: ConnectionBad:无法将主机名“ postgres”转换为地址:没有与主机名关联的地址。

数据库

configure :test do
  set :database,{
    adapter: 'postgresql',encoding: 'utf8',database: 'onebitbot_test',pool: 5,username: 'postgres',host: 'postgres'
  }
end

configure :development do
  set :database,database: 'onebitbot_development',host: 'postgres'
  }
end

DOCKER-COMPOSE.YML

version: '3'

services:
  postgres:
    image: 'postgres:9.5'
    volumes:
      - 'postgres:/var/lib/postgresql/data'

  website:
    depends_on:
      - 'postgres'
    build: .
    ports:
      - '9292:9292'
    volumes:
      - '.:/onebitbot'
    environment:
      - LANG=C.UTF-8

volumes:
  postgres:

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)