Answer the question
In order to leave comments, you need to log in
Why doesn't Docker-compose link the container to the database?
Good afternoon.
I'm trying to figure out docker-compose.
I did it on one project (rails): one container with an application that I build myself, the second one with a database (postgresql) - everything came together and worked:
web:
build: .
volumes:
- .:/myapp
ports:
- "3000:3000"
links:
- db
env_file:
- '.env.web'
db:
image: library/postgres:9.4.6
ports:
- "5432:5432"
env_file:
- '.env.db'
web:
build: .
volumes:
- .:/voip
ports:
- "3000:3000"
links:
- redis
- db
env_file:
- '.env.web'
db:
image: library/postgres:9.4.6
ports:
- "5432:5432"
env_file:
- '.env.db'
redis:
image: redis
ports:
- "6379:6379"
Couldn't create database for {"adapter"=>"postgresql", "encondig"=>"unicode", "pool"=>5, "username"=>"postgres", "database"=>db_production", "host"=>"db", "password"=>"mysecretpassword"}
rake aborted!
PG::ConnectionBad: could not translate host name "db" to address: Name or service not known
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question