Not link containers on stack created with rancher 1.2

Hello, I have a problem with the link of containers. In Rancher 1.1 all was fine, but after upgrade to 1.2, the problem is that I have ping to ip of containers but not to the hostname of it.
My docker-compose is similiar to this:

    db:
  restart: always
  image: postgres:9.4
  environment:
    - POSTGRES_USER=postgres
    - POSTGRES_PASSWORD=postgres
  ports:
    - "5432"
  volumes:
    - /srv/labla/postgres/:/var/lib/postgresql/data/
  labels:
    io.rancher.scheduler.affinity:host_label: labla=true
    io.rancher.scheduler.global: 'true'
  net: bridge

redis:
  restart: always
  container_name: labla_redis
  image: redis:3.2.3
  volumes:
    - /srv/labla/redis/:/data
  labels:
    io.rancher.scheduler.affinity:host_label: labla=true
    io.rancher.scheduler.global: 'true'
  net: bridge

web:
  restart: always
  image: myregistry.bla/labla
  links:
    - db:db
    - redis:redis
  ports:
    - "80"
  environment:
    - PASSENGER_APP_ENV=production
    - RAILS_ENV=production
  labels:
    io.rancher.scheduler.affinity:host_label: labla=true
    io.rancher.scheduler.global: 'true'
  net: bridge

Inside web container I try to ping to db without success. But when I ping with the ip of db, It is ok…
I am using Rancher 1.2.1.

Thank You!

I am finding the same issue. Making Rancher unusable. Just glad this was still in testing or I would be in trouble.

I have a number of services defined in a “Backend” stack, and I link to these in my “WebServers” stack. However, many of the links so not work, returning “host not found” if I try to ping from the container.

If I then Edit the service and change the link, save it then change it back to what it should be it might work, but then other links stop working.

1 Like

The only solution that I found is copy the docker-compose.yml and the do a docker-compose up -d
In this way, works, without “stack management on docker UI”. I noticed that in this last case, the file in /etc/hosts has the ip and names of other containers. Elsewhere when create a stack with rancher UI, the file in /etc/hosts inside container it isn’t have the names and ips of linked containers in order to resolve to each one…

It is a bug?

This issue is still there in 1.3.0. I’m surprised more aren’t experiencing it.

After upgrading from 1.1.4 to 1.3.1 I am also running into similar issues. When the target is within the same stack it appears to work for me, but when it is in a separate stack the alias does not work.

I was forced to not use target alias and go with the full DNS entry: “service_name.stack_name”

Hope that helps.