BUG #15854: postgres wtih Docker: binding port fails with release greater than 9.6.13

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: lcj34(at)cornell(dot)edu
Subject: BUG #15854: postgres wtih Docker: binding port fails with release greater than 9.6.13
Date: 2019-06-16 12:35:07
Message-ID: 15854-544de1495db7399b@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15854
Logged by: Lynn Johnson
Email address: lcj34(at)cornell(dot)edu
PostgreSQL version: 11.3
Operating system: CentOS 7.6.1810
Description:

I am running Postgres in a docker, creating a container, mounting a
directory, binding a port. The container comes up successfully and I can
run psql to enter. But only for release 9.6. When I pull postgres docker
image for anything greater than 9.6 (I tried with 10, 10.3, 11.3) the
binding fails. here are specifics:

1. pull docker images via the following (pulling both 9.6 and latest for
testing):
docker pull postgres:latest
docker pull postgres:9.6.13

2. Create a container with mount points for 9.6.13:
docker run -i --detach --name lcj34__biohpc_phg_postgres_container -e
POSTGRES_PASSWORD=phgP0stgr3s -v
/workdir/lcj34/DockerPostgresTests_working/dockerDB_data/data:/var/lib/postgresql/data
-p 8010:5432 postgres:9.6

3. Start the container from above:
docker start lcj34__biohpc_phg_postgres_container

4. enter with psql gives these results:
[lcj34(at)cbsubl01 DockerPostgresTests_working]$ psql -h localhost -p 8010 -U
postgres
Password for user postgres:
psql (9.2.24, server 9.6.13)
WARNING: psql version 9.2, server version 9.6.
Some psql features might not work.
Type "help" for help.

postgres=# \q

IT is successful.

Remove the running container, start again but use a postgres version later
than 9.6. here I'm using "latest", pulled on June 16, 2019. note the
commands below are identical to the example above except for the postgres
docker image used.

1. Create container:
docker run -i --detach --name lcj34__biohpc_phg_postgres_container -e
POSTGRES_PASSWORD=phgP0stgr3s -v
/workdir/lcj34/DockerPostgresTests_working/dockerDB_data/data:/var/lib/postgresql/data
-p 8010:5432 postgres:latest

2. Start container:
docker start lcj34__biohpc_phg_postgres_container
3. Try at connect with psql give this response:
[lcj34(at)cbsubl01 DockerPostgresTests_working]$ psql -h localhost -p 8010 -U
postgres
psql: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 8010?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 8010?
[lcj34(at)cbsubl01 DockerPostgresTests_working]$

Using net stat, I can see port 8010 was not bound:

[lcj34(at)cbsubl01 DockerPostgresTests_working]$ netstat -tulpn | grep LISTEN
(No info could be read for "-p": geteuid()=1719 but you should be root.)
tcp 0 0 0.0.0.0:5801 0.0.0.0:* LISTEN
-
tcp 0 0 0.0.0.0:49258 0.0.0.0:* LISTEN
-
tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN
-
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
-
tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN
-
tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN
-
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
-
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
-
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
-
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN
-
tcp 0 0 127.0.0.1:6012 0.0.0.0:* LISTEN
-
tcp 0 0 0.0.0.0:988 0.0.0.0:* LISTEN
-
tcp 0 0 0.0.0.0:3071 0.0.0.0:* LISTEN
-
tcp6 0 0 :::5801 :::* LISTEN
-
tcp6 0 0 :::5901 :::* LISTEN
-
tcp6 0 0 :::111 :::* LISTEN
-
tcp6 0 0 :::6000 :::* LISTEN
-
tcp6 0 0 :::6001 :::* LISTEN
-
tcp6 0 0 :::22 :::* LISTEN
-
tcp6 0 0 ::1:631 :::* LISTEN
-
tcp6 0 0 ::1:25 :::* LISTEN
-
tcp6 0 0 ::1:6010 :::* LISTEN
-
tcp6 0 0 ::1:6012 :::* LISTEN
-
[lcj34(at)cbsubl01 DockerPostgresTests_working]

I believe this is a postgres issue vs docker issue as the only change from
working to non-working is the postgres image from docker. Or perhaps this
ticket should be against the post 9.6 postgres dockers.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-06-16 14:15:22 Re: BUG #15854: postgres wtih Docker: binding port fails with release greater than 9.6.13
Previous Message YunQiang Su 2019-06-16 04:38:05 Re: BUG #15844: MIPS: remove .set mips2 in s_lock.h to fix r6 build