-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pre Backup Command for MySQL with ">" character does not work #32
Comments
Hi,
I have no issue with the ">" character When I run the ./backup command from the backup container console I get something like :
I tried to run the mysqldump command from the db container's console : it's fine. Thanks for your help. |
Did you try to pass your password without single quotes? |
I suppose I am having problems about preventing my shell to interpret '>' instead of passing it to inner shell. The behaviour still continues on both Amazon Linux AMI and MacOS. Indeed, I suspect the backup container fails to pass the '>' character to the db container while running this: I appreciate any help! Digging... |
Yes but I have some special chars in the password and it does not work without those :-( |
Silly suggestion but did you try without the path ? |
Thanks anyway :) Yes, I tried. No luck :( I removed Pre-exec command: 4a907b4efb38 mysqldump -u root --password=123456* wordpress > /tmp/mysql.sql
mysqldump: [Warning] Using a password on the command line interface can be insecure.
mysqldump: Couldn't find table: ">"
It seems like it interprets PS: My password contains UPDATE |
Redirecting the output of a command running inside the docker container would require setting the interactive flag on the
I'm looking for a way to labels:
- docker-volume-backup.exec-pre-backup=pg_dump --dbname=$POSTGRES_DB > /tmp/backup/recipes.pgsql
- docker-volume-backup.exec-pre-backup=pg_dump --dbname=$POSTGRES_DB > /tmp/backup/recipes.pgsql But it is throwing "file not found" errors. This is expected, as the path |
Well, now I feel stupid. I should have read the link above to the end. 😅 Here's a working configuration: labels:
- docker-volume-backup.exec-pre-backup=sh -c "pg_dump --dbname=$POSTGRES_DB > /tmp/backup/recipes.pgsql"
- docker-volume-backup.exec-post-backup=rm -rfv /tmp/backup/recipes.pgsql The trick is to wrap the command in |
docker-compose.yml (simplified for clearity):
When I run this command:
docker compose exec backup ./backup.sh
I get this:
When I change pre-backup command by removing ">" character and the file, it dumps all sql to stdout and works well. However, it is useless to print all sql to stdout.
I am not sure this a bug of this repository or docker.
I appreciate any help. Thanks in advance.
The text was updated successfully, but these errors were encountered: