Docker Community Forums

Share and learn in the Docker community.

Linked container cannot be resolved on the service

(Luizkowalski) #1

I have a Java app that connects to a Postgres with Docker/Docker compose.
Here is the config for docker environment:


  profiles: docker

    jdbcUrl: jdbc:postgresql://postgres/chathub

as you can see, the hostname is postgres, defined in the docker-compose.yml as follow:

  image: postgres:9.5
    - "5432:5432"
    POSTGRES_USER: postgres
    POSTGRES_DB: test
    - /var/lib/postgresql
  build: user/image
    - "8080:8080"
    - redis
    - postgres
    - rabbitmq

when I try to import this stack to docker-cloud, I get this error when app is starting up

chathub-1 | 2016-05-13T13:16:49.780710069Z 	... 60 more
chathub-1 | 2016-05-13T13:16:49.780715135Z Caused by: postgres
chathub-1 | 2016-05-13T13:16:49.781300906Z 	at
chathub-1 | 2016-05-13T13:16:49.781682657Z 	at
chathub-1 | 2016-05-13T13:16:49.781858324Z 	at
chathub-1 | 2016-05-13T13:16:49.782043587Z 	at org.postgresql.core.PGStream.<init>(
chathub-1 | 2016-05-13T13:16:49.782240790Z 	at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(
chathub-1 | 2016-05-13T13:16:49.782739855Z 	... 68 more

seems like the somehow, the links are missing in docker cloud. I tried with postgres-1 too and didn’t worked

(Luizkowalski) #2

I’m still facing this issue.
What I tried:

  • Remove service links on stackfile;
  • With service links removed, tried to use the hostname on the app (like postgres and postgres-1)

Nothing worked so far

(Dleblanc) #3

I’m having much the same issue here - sometimes a mix of redeployment / terminate and start seems to help. I wasn’t seeing any of this on Tutum.

(Viveksaini07) #4

Same issue here as well. Hostname is not getting resolved.

(Luizkowalski) #5

Hey guys
I fixed it NOT using the alpine image versions

(Viveksaini07) #6

Is there any way to make it work with alpine base image?

(Iteamnetworkdc) #7

If you use alpine:edge, it should fix DNS issues

( (Charlie)) #8

The DNS fix has been merged from :edge into 3.4.


So use alpine:3.4 as your base image.