How to use Percona Toolkit in a Docker container?

Hi,
I’m using Windows 10 and running MySQL 5.7.26 on this machine.
I download the docker image perconalab/percona-toolkit 3.2.0 from https://hub.docker.com/r/perconalab/percona-toolkit .
I try to run the container with the command as below.
docker container run --name PerconaToolkit -it perconalab/percona-toolkit /bin/bash
I can ping my machine from the container. But I cannot call pt-mysql-summary, it says “Cannot execute mysql”.
pt-mysql-summary --host=192.168.16.6 --port=3306 --user=root --all-databases --ask-pass


Does anyone know how to run percona toolkit command to access to the remote MySQL from a docker container?
Thank you very much.
Regards,
Kevin

1 Like

The code of pt-mysql-summary seems to be requiring mysql and mysqldump but I didn’t find it in the docker image.

1 Like

@kevinhoangvn Hello. Do you know now how to use percona-toolkit in Docker container?
I also don’t know how percona-toolkit should access a database without a client. It is also very pity by Percona not even provide a manual. Furthermore it is very confusing where the docker image you mentioned comes from. The docker image by perconalab probably uses the Dockerfile out of percona-docker/Dockerfile at main · percona/percona-docker · GitHub. But there is also a github profile for “perconalab” percona-docker/Dockerfile at master · Percona-Lab/percona-docker · GitHub.
For now I only see the solution to build own Docker Image where Database Client is installed. But then I don’t really understand why the clients are not installed in the Dockerfile directly or why there is even a Docker Image provided in Docker Hub if it cannot be used.

1 Like

Ok I found out that if you use the Dockerfile in percona-docker/Dockerfile at main · percona/percona-docker · GitHub and build the image by your own it has the mysql client. Probably delivered with percona-server-client package.

But anyway it is very confusing that there is a docker image under perconalab which seems to be the same but isn’t. So perconalab should update it or remove it. Best would be if percona would build automatically and push into Docker user percona.

1 Like

It appears that percona/percona-toolkit no longer has this problem.

Example with docker-compose.yml, similar to what I added myself:

  database-toolkit:
    container_name: database-toolkit
    image: percona/percona-toolkit
    restart: no
    profiles: ["diagnostics-only"]
    user: root
    volumes:
      - /path/to/db/files/:/var/lib/mysql:rw
      - ./conf/my.cnf:/etc/my.cnf:ro
    networks:
      - database

And then invoking it:

docker compose run --rm database-toolkit pt-mysql-summary --password xyz

Note: not recommended to put the password in the command.

1 Like