psql
を使用して PostgreSQL のシェル ( )にアクセスしようとしていますdocker-compose
が、問題が発生しています...docker-compose
ファイルは次のとおりです。
main:
build: .
volumes:
- .:/code
links:
- postgresdb
environment:
- DEBUG=true
postgresdb:
build: utils/sql/
ports:
- "5432"
environment:
- DEBUG=true
実行して、サービスと同様にアクセスpsql
してアクセスしようとしましたmain
postgresdb
docker-compose run postgresdb psql -h postgresdb -U docker mydatabase
しかし、私が得たのは...データベース構成ファイルでホストとしてpsql: could not translate host name "postgresdb" to address: Name or service not known
使用しているため、理解できません。postgresdb
DB_ACCESS = {
'drivername': 'postgres',
# Name of docker-compose service
'host': 'postgresdb',
'port': '5432',
'username': 'docker',
'password': '',
'database': 'mydatabase'
}