What I try to implement is invoking mysqldump
in container and dump the database into the container's own directory.
At first I try command below:
$ docker exec container-name mysqldump [options] database | xz > database.sql.xz
That's not working, so I try another one which is :
$ docker exec container-name bash -c 'mysqldump [options] database | xz > database.sql.xz'
This time it worked.
But that's really lame.
Then I try using docker-py this time cmd
option that worked looks like this:
cmd=['bash', '-c', 'mysqldump [options] database | xz > database.sql.xz']
the logger event as below:
level="info" msg="-job log(exec_start: bash -c mysqldump [options] database | xz > database.sql.xz, fe58e681fec194cde23b9b31e698446b2f9d946fe0c0f2e39c66d6fe68185442, mysql:latest) = OK (0)"
My question:
is there a more elegant way to archive my goal?