The question is basically in the title already. At first I thought about a one-liner but maybe a short script is fine as well.

The command or script is meant to initiate all updating on the actual data that is required when stepping up to the next or a specified major release of mariadb.


  • Let's assume we are on an up-to-date Ubuntu 22.04 system
  • The mariaddb container is part of some service that was brought up via docker-compose
  • the official mariadb image from https://hub.docker.com/_/mariadb is used
  • We are in the folder ($PWD) of the corresponding docker-compose.yaml file
  • The mariadb container and data is currently on 10.5.? and it should finally upgrade to 10.10.2 for instance, may it be directly or step-by-step.
  • the data are actually stored on a mapped volume (alternatively in a named volume)
  • Normally you upgrade containerised applications by starting a new container image that has the newer application version.
    – mustaccio
    Dec 8, 2022 at 21:14
  • @mustaccio That part of the upgrade is clear to me. My question focused on how to trigger the upgrade of the data structures which is needed when stepping to the next major release.
    – datenheim
    Dec 9, 2022 at 10:13
  • That depends on the particular image you're using; every image maintainer might implement it differently, so you'll need to consult their documentation.
    – mustaccio
    Dec 9, 2022 at 12:59
  • @mustaccio good point, I have added the used image now
    – datenheim
    Dec 9, 2022 at 16:51

1 Answer 1

  1. docker compose down. Do NOT docker compose kill, MariaDB must be cleanly shutdown.
  2. take backup of the volume:
    mkdir -p backup
    docker run --rm \
      -v "$VOLUME_NAME":/backup-volume \
      -v "$(pwd)":/backup \
      busybox \
      tar -zcvf /backup/my-backup.tar.gz /backup-volume```

(ref; docker blog)

  1. change the compose file to the 10.10 tag or whatever suits you
  2. Add env: MARIADB_AUTO_UPGRADE=1 to the compose file
  3. docker compose up
  4. look at the container logs and test connection.
  5. if there is "InnoDB: Upgrade after a crash is not supported." in the log, that means it wasn't cleanly shutdown. Shutdown cleanly, go back to the 10.5 tag and start again. Do NOT google around or delete a the ib_logfile0. It won't start after that.
  • Thanks, I did not notice that it's possible to trigger the upgrade via environment variables from the compose file. Is it a problem if that variable remains after the update, or MUST it be removed if the update is finished? Can I really jump over many major release numbers and do not need to go up step-by-step?
    – datenheim
    Dec 9, 2022 at 10:07
  • 1
    The MARIADB_AUTO_UPGRADE=1 environment variable can remain without impact - versions are checked before upgrade is attempted. Yes you can upgrade using any jump in versions.
    – danblack
    Dec 10, 2022 at 5:12
  • upgrade from 10.5.13 to 10.10.2 ran totally flawless in a single step.
    – datenheim
    Dec 10, 2022 at 22:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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