Обсуждение: BUG #15854: postgres wtih Docker: binding port fails with release greater than 9.6.13
BUG #15854: postgres wtih Docker: binding port fails with release greater than 9.6.13
От
PG Bug reporting form
Дата:
The following bug has been logged on the website: Bug reference: 15854 Logged by: Lynn Johnson Email address: lcj34@cornell.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@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@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@cbsubl01 DockerPostgresTests_working]$ Using net stat, I can see port 8010 was not bound: [lcj34@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@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.
PG Bug reporting form <noreply@postgresql.org> writes: > 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: It looks like the postmaster is failing to start. The place to look to find out the cause of that is in the postmaster's log file. Unfortunately I don't use docker so I don't know how it configures the postmaster's logging; but if you look into the start recipe you should be able to find where it's redirecting the process's stderr, and that would get you started. regards, tom lane
Re: BUG #15854: postgres wtih Docker: binding port fails with releasegreater than 9.6.13
От
Mark Kirkwood
Дата:
On 17/06/19 12:35 AM, PG Bug reporting form wrote: > > 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 What I suspect is happening is this: the volume you used for the 9.6 container still has the database files there (even after the container has stopped), so when you try to reuse it for a later version the new postmaster will refuse to start. I suggest naming the volume path with a version. e.g: docker run -i --detach --name lcj34__biohpc_phg_postgres_container -e POSTGRES_PASSWORD=phgP0stgr3s -v /workdir/lcj34/DockerPostgresTests_working/dockerDB_data/10:/var/lib/postgresql/data regards Mark
Re: BUG #15854: postgres wtih Docker: binding port fails with releasegreater than 9.6.13
От
Lynn Carol Johnson
Дата:
Mark's response was the problem. I was mounting to the same place where the 9.6 db had previously been mounted. When Icreated a new mount point for the 11.3 data, it worked. I don't see how to mark this bug as "resolved" from the web but would like to mark this resolved On 6/16/19, 10:15 AM, "Tom Lane" <tgl@sss.pgh.pa.us> wrote: PG Bug reporting form <noreply@postgresql.org> writes: > 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: It looks like the postmaster is failing to start. The place to look to find out the cause of that is in the postmaster's log file. Unfortunately I don't use docker so I don't know how it configures the postmaster's logging; but if you look into the start recipe you should be able to find where it's redirecting the process's stderr, and that would get you started. regards, tom lane
Lynn Carol Johnson <lcj34@cornell.edu> writes: > Mark's response was the problem. I was mounting to the same place where the 9.6 db had previously been mounted. WhenI created a new mount point for the 11.3 data, it worked. Ah, cool. > I don't see how to mark this bug as "resolved" from the web but would like to mark this resolved We don't have a formal process for marking bugs closed, other than somebody posting to the mail thread saying the problem is fixed. So your mail is sufficient for that. We appreciate your following up! regards, tom lane