[Django]-Postgres to Ubuntu Docker container linking not working

0👍

Check that your postgresql.conf has listen_addresses = '*'

The default is listen_addresses = 'localhost', which would behave in the manner you describe.

Edit:

This works for me, does it work for you?

$ docker pull postgres
$ docker pull django
$ docker run -d --name db -d postgres
$ docker run -it --link db:db django bash
root@11c767bd3d09:/#  psql -h db -U postgres
psql (9.4.3, server 9.4.4)
Type "help" for help.

postgres=#

Edit (Docker 1.7.1 output)

$ docker rm $(docker ps -a -q)
$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
django              latest              29755dd6751b        3 days ago          434.5 MB
postgres            latest              f33438ff9aef        3 days ago          265.5 MB
$ docker -v
Docker version 1.7.1, build 786b29d
$ docker run -d --name db -d postgres
$ docker run -it --link db:db django bash
root@11c767bd3d09:/#  psql -h db -U postgres
psql (9.4.3, server 9.4.4)
Type "help" for help.

postgres=#
👤Travis

Leave a comment