I'm running CraftCMS via 3 Docker containers in 1 Docker network:

  • Container 1 - MySQL
  • Container 2 - Nginx
  • Container 3 - PHP:7.4-fpm

When I run php craft update craft from container 3 and choose to backup the db, I get this error:

Backup the database? (yes|no) [yes]:yes
Backing up the database ... error: The shell command "mysqldump --defaults-extra-file="/tmp/hvncbmcornry.cnf" --add-drop-table --comments --create-options --dump-date --no-autocommit --routines --default-character-set=utf8 --set-charset --triggers --no-tablespaces --single-transaction --no-data --result-file="/app/storage/backups/my-site--2021-05-26-052145--v3.6.15.sql" craftcms && mysqldump --defaults-extra-file="/tmp/hvncbmcornry.cnf" --add-drop-table --comments --create-options --dump-date --no-autocommit --routines --default-character-set=utf8 --set-charset --triggers --no-tablespaces --no-create-info --ignore-table=craftcms.assetindexdata --ignore-table=craftcms.assettransformindex --ignore-table=craftcms.sessions --ignore-table=craftcms.templatecaches --ignore-table=craftcms.templatecachequeries --ignore-table=craftcms.templatecacheelements --ignore-table=craftcms.cache --ignore-table=craftcms.templatecachecriteria craftcms >> "/app/storage/backups/my-site--2021-05-26-052145--v3.6.15.sql"" failed with exit code 127: sh: 1: mysqldump: not found

It looks like the mysqldump command doesn't exist in Container 3 as I don't get a result when running: which mysqldump. Running this which command from container 1 does however return: /usr/bin/mysqldump. But in this container, I don't have access to my project.


Sounds like your php-fpm container 3 needs to install the MySQL client tools in it, so that mysqldump is available in the container similar to https://github.com/craftcms/docker/blob/main/7.4/dev.Dockerfile#L18


I tried to install mysq-client but got this error: Package 'mysql-client' has no installation candidate After installing mariadb-client, everything worked as expected!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.