Reputation: 33462
I want to execute a command that uses commands from multiple containers.
E.g., I want to execute a backup script that used psql and pg_dump commands.
docker exec db_backup pg_dump
failed to exec: exec: "pg_dump": executable file not found in $PATH
docker run
has an option --link
. Is there a similar option for exec
?
To clear this up, there are 3 containers:
I want to use pg commands located in db
from my db_backup
scripts.
Upvotes: 0
Views: 2325
Reputation: 7195
There is not --link
option for docker exec
. If you want to backup using a special script:
db_backup
starting from the postgresql one (the one that the db
container uses), adding the backup script to some folder.docker run --volumes-from db db_backup your_backup_script.sh
.Upvotes: 1
Reputation: 12847
1) go to the db
shell by using sudo docker run -ti db /bin/bash
2) type which pg_dump
or locate pg_dump
if the first fails
3) use the full path in your command sudo docker exec db /full_path_to/pg_dump
run the 3) inside your db
container
note: on my Fedora the pg_dump
points to /usr/bin/pg_dump
Upvotes: 0