Running Percona XtraBackup on Windows … in Docker

Percona XtraBackupIn this blog, we’ll look at running Percona XtraBackup on Windows via a Docker container.

The question whether Percona XtraBackup is available for Windows comes up every so often. While we are not planning to provide regular releases for Windows, I decided to share a way to run Percona XtraBackup in a Docker container (especially since Docker support for Windows has become more and more stable).

For this exercise, I created a playground Docker image: perconalab/percona-xtrabackup.

First, we need to prepare a few things to make it work:

  1. Install Docker on Windows (the current version I am running is 17.03)
  2. Enable the sharing of disk C in Docker settings
  3. Find out the IP address MySQL is running on ( in my case)
  4. Grant backup-required privileges for the xtrabackup user:


Now, let’s assume our datadir is in C:/mysqldata, and we want to backup to C:/mysqlbackup. Needless to say, that XtraBackup image must run on the same server as MySQL’s datadir (since XtraBackup needs to access the data to copy it).

Now to take a backup we execute:

docker run --rm -it -v //C/mysqldata:/var/lib/mysql -v //C/mysqlbackup:/xtrabackup_backupfiles perconalab/percona-xtrabackup --backup --host= --user=xtrabackup --password=xtrapassword

We find our backup in C:/mysqlbackup when it is done.


Share this post

Comments (9)

  • Peter Laursen

    I was able to install XtraBackup on “bash in Windows” directly/natively from Ubuntus repository (“sudo apt-get install ..” or use “Synaptic” GUI softare management tool). But I haven’t tested if it works. Have you?

    If you don’t know “bash in Windows” you can start here:

    March 21, 2017 at 10:39 am
  • Peter Laursen

    It does not seem so:

    peter@SH-WIN10:/mnt/c/Users/jazcy$ xtrabackup –user=root –password=secret -host= –port=3308 –backup –target-dir=\test
    prctl() failed with errno = 22

    No diference if I install rpctl. Maybe “bash in Windows” will not be allowed to get the information from the system it needs or rpctl is simply incompatible with Windows and not translated to Windows system calls on this environment . It would be nice to avoid Docker, so if there is a solution it would be nice


    March 21, 2017 at 11:07 am
    • Vadim Tkachenko


      I did not try bash in Windows, but I will try to see if we can make it running

      March 21, 2017 at 5:43 pm
    • Vadim Tkachenko

      Apparently the current bash for Windows does not support prctl system call, but supposedly it will be fixed in Windows 10 Creators Edition
      So hopefully it will work better then.

      March 22, 2017 at 6:44 pm
    • Vadim Tkachenko


      I’ve just tested in Windows 10 Creators Edition and the problem is resolved. Windows added support for prctl system call.

      April 7, 2017 at 10:39 am
  • Peter Laursen

    correction. no diference if I install prctl

    March 21, 2017 at 11:36 am
  • Vadim Tkachenko

    UPDATE for using percona-xtrabackup image for 2.4.11 version.

    The following parameter should be added to the command line:

    so the full command looks like:

    docker run --rm -it -v //C/mysqldata:/var/lib/mysql -v //C/mysqlbackup:/xtrabackup_backupfiles perconalab/percona-xtrabackup --backup --host= --user=xtrabackup --password=xtrapassword --innodb-undo-directory=/var/lib/mysql

    May 13, 2018 at 2:54 pm
  • LongFly

    Is incremental backup supported?

    September 18, 2018 at 5:45 am
  • Amine

    PS C:\Users\Dell> docker run –rm -it -v //C//DATA:/var/lib/mysql -v //C/mysqlbackup:/xtrabackup_backupfiles perconalab/percona-xtrabackup –backup –host=localhost –user=xtrabackup –password=xtrapassword
    Unable to find image ‘perconalab/percona-xtrabackup:latest’ locally
    C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: Get unauthorized: incorrect username or password.
    See ‘C:\Program Files\Docker\Docker\Resources\bin\docker.exe run –help’.

    can you help me please

    May 31, 2019 at 3:41 am

Comments are closed.

Use Percona's Technical Forum to ask any follow-up questions on this blog topic.