Hi Docker folks,
I have a docker-compose.yml
file and it works fine in my lap (Mac OS Sierra, docker-compose
version 1.12.0
). However, when using it on staging (Debian jessie, docker-compose
version 1.11.2
, my service cannot connect to the database service.
Here is my docker-compose.yml
file:
version: '2.0'
services:
my-service:
image: my-service:staging
working_dir: /usr/share/my-service
environment:
- PGSQL_URL=postgres://postgres:postgres@db/my-service-staging
- REDIS_URL=redis://redis:6379/0
depends_on:
- db
- rabbitmq
- redis
links:
- db
- rabbitmq
- redis
restart:
on-failure:5
rabbitmq:
image: healthcheck/rabbitmq:latest
db:
image: healthcheck/postgres:latest
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=my-service-staging
redis:
image: redis
volumes:
- /var/lib/redis:/data
I try to ping
db
service from inside one of the running container and it works fine in my laptop. However I cannot ping db
service in staging environment.
Hence, I suspect there is a network issue. However, I dont know how to debug it.
Really appreciate if anyone have any idea that I can tackle this issue.
Thank you in advance
Cheers,
Bang