PG_DUMPALL not executable within docker container

Started by Patrick Frießneggover 2 years ago3 messagesbugs
Jump to latest
#1Patrick Frießnegg
patrick.fri@gmail.com

Steps to reproduce:

Startup Container:
```sh
synesc@dockerhost01:$ docker run --rm -it postgres:15.4 /bin/bash
```

Execute PG_DUMPALL, Params not required to see the issue.
```sh
root@13fba0e113c7:/# pg_dumpall
popen failure: Cannot allocate memory
pg_dumpall: error: program "pg_dump" is needed by pg_dumpall but was not
found in the same directory as "/usr/lib/postgresql/15/bin/pg_dumpall"
root@13fba0e113c7:/#
```

Was not able to fix the problem, with full parameter list.

--
Ing. Frießnegg Patrick
Synesc GmbH
mailto: patrick.fri@gmail.com

#2Daniel Gustafsson
daniel@yesql.se
In reply to: Patrick Frießnegg (#1)
Re: PG_DUMPALL not executable within docker container

On 27 Sep 2023, at 10:43, Patrick Frießnegg <patrick.fri@gmail.com> wrote:

root@13fba0e113c7:/# pg_dumpall
popen failure: Cannot allocate memory
pg_dumpall: error: program "pg_dump" is needed by pg_dumpall but was not found in the same directory as "/usr/lib/postgresql/15/bin/pg_dumpall"

pg_dumpall runs the pg_dump binary, so when starting up it locates and tries to
execute pg_dump to check its version. The above error indicates that the
binary does indeed exist, but when trying to execute it there is a problem with
the popen() call. A quick search reveals that this has been reported against
Docker (and has been fixed it seems):

https://github.com/docker-library/postgres/issues/1103

As this is not a bug in postgres, pgsql-general is probably a better
mailinglist to use for help.

--
Daniel Gustafsson

#3Patrick Frießnegg
patrick.fri@gmail.com
In reply to: Daniel Gustafsson (#2)
Re: PG_DUMPALL not executable within docker container

Thank you very much. Found the Key point here:

*Current Setup:*synesc@dockerhost01:~/$ lsb_release -a
No LSB modules are available.
Distributor ID:
Ubuntu Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal
synesc@dockerhost01:~/$ docker --version
Docker version 20.10.0, build 7287ab3

Issue exists with docker image *postgres:15.4*

PG_DUMPALL
postgres | popen failure: Cannot allocate memory
postgres | pg_dumpall: error: program "pg_dump" is needed by pg_dumpall
but was not found in the same directory as
"/usr/lib/postgresql/15/bin/pg_dumpall"

STARTUP/INITDB
postgres | popen failure: Cannot allocate memory
postgres | initdb: error: program "postgres" is needed by initdb but was
not found in the same directory as "/usr/lib/postgresql/15/bin/initdb"

*Different Setup:*
master@dockerhost:~/$ lsb_release -a
No LSB modules are available.
Distributor ID:
Ubuntu Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
master@dockerhost:~/$ docker --version
Docker version 24.0.6, build ed223bc

On this different (newer) setup the issues do not exist.

*Solution*
Use appropriate docker-image.
https://askubuntu.com/questions/445487/what-debian-version-are-the-different-ubuntu-versions-based-on

version | ubuntu | debian
22.04 | jammy | bookworm/ sid
20.04 | focal | bullseye/ sid

With the docker-image *postgres:15.4-bullseye* it does work on the Ubuntu
20.04 setup.
Not really happy with the behaviour. Would suggest to add a note to
docker-hub description what image to pick.

--
Ing. Frießnegg Patrick
Synesc GmbH
mailto: patrick.fri@gmail.com