Docker Community Forums

Share and learn in the Docker community.

How to fix the error 'OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"pg_dumpall\": executable file not found in $PATH": unknown' while trying to backup PostgreSQL database from Docker container?

When I run the command I found here:

docker exec -t your-db-container pg_dumpall -c -U postgres > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql

A very small size dump .sql file is generated and it says this when opened:

OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"pg_dumpall\": executable file not found in $PATH": unknown

I get the same error if I run this command:

sudo docker exec portainer pg_dump -c yagpdb > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql

I then tried this command:

sudo docker exec portainer /var/lib/postgres/bin/pg_dump -c yagpdb > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql

I got this error: OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"/var/lib/postgres/bin/pg_dump\": stat /var/lib/postgres/bin/pg_dump: no such file or directory": unknown

Finally, I tried this but didn’t work.

ubuntu@ip-123:~/yagpdb/yagpdb_docker$ sudo docker exec -ti portainer /bin/bash
OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown

What should I do next? I want to get the postgresql stuck in Docker container to move to different VPS. This is the docker image I am using: https://hub.docker.com/r/teyker/yagpdb