Docker Community Forums

Share and learn in the Docker community.

[RESOLVED] Unable to connect to linked service through hostname


(Arealmaas) #1

Hi, I seem to have trouble connecting a service to another linked service by using the hostname. It works with docker-compose, but not for docker cloud. No host entries in /etc/hosts exists for the linked services for the container i want to link to the service.

My docker-compose.yml:

web:
  build: .
  command: npm start
  volumes:
   - .:/code
  expose:
     - "3000"
  links:
   - mongo:mongo
   - redis:redis
mongo:
  image: mongo
redis:
  image: redis
lb:
  image: 'dockercloud/haproxy:latest'
  links:
    - web
  ports:
    - '80'

My docker-cloud.yml:

lb:
  image: dockercloud/haproxy
  links:
    - web:web
  ports:
    - "80"
  roles:
    - global
web:
  image: arealmaas/groovy-user-management
  command: npm start
  expose:
     - "3000"
  links:
    - mongo:mongo
    - redis:redis
  target_num_containers: 2
mongo:
  image: mongo
redis:
  image: redis

Connecting to both redis and mongodb using redis/mongo(service-name) as hostname, and the exposed port (27017/6379).

Is there something i’m missing here?


(Arealmaas) #2

Turned out to be the alpine-image that was causing this…!


(Borja Burgos) #3