# How to use Percona Toolkit in a Docker container?

**URL:** <https://forums.percona.com/t/how-to-use-percona-toolkit-in-a-docker-container/7883>\
**Category:** Percona Toolkit\
**Created:** [August 11, 2020, 3:45am UTC](https://forums.percona.com/t/how-to-use-percona-toolkit-in-a-docker-container/7883 "2020-08-11T03:45:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevinhoangvn](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/kevinhoangvn/32/96_2.png) [@kevinhoangvn](https://forums.percona.com/u/kevinhoangvn)\
**Post date:** [August 11, 2020, 3:45am UTC](https://forums.percona.com/t/how-to-use-percona-toolkit-in-a-docker-container/7883/1 "2020-08-11T03:45:10Z")

</div>

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&nbsp;[https://hub.docker.com/r/perconalab/percona-toolkit](https://hub.docker.com/r/perconalab/percona-toolkit)&nbsp;.  
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  
  
 ![]()

 ![](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/1X/136619bb0db661e05f2271cc95b23f939df45f18.png)  
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

---

<div class="post-metadata">

**Author:** ![Ctrl4](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ctrl4/32/32_2.png) [@Ctrl4](https://forums.percona.com/u/Ctrl4)\
**Post date:** [August 13, 2020, 8:11am UTC](https://forums.percona.com/t/how-to-use-percona-toolkit-in-a-docker-container/7883/2 "2020-08-13T08:11:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![matze](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@matze](https://forums.percona.com/u/matze)\
**Post date:** [March 22, 2022, 12:01pm UTC](https://forums.percona.com/t/how-to-use-percona-toolkit-in-a-docker-container/7883/3 "2022-03-22T12:01:42Z")

</div>

@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](https://github.com/percona/percona-docker/blob/main/percona-toolkit/Dockerfile). But there is also a github profile for “perconalab” [percona-docker/Dockerfile at master · Percona-Lab/percona-docker · GitHub](https://github.com/Percona-Lab/percona-docker/blob/master/percona-toolkit/Dockerfile).  
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.

---

<div class="post-metadata">

**Author:** ![matze](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@matze](https://forums.percona.com/u/matze)\
**Post date:** [March 23, 2022, 12:38pm UTC](https://forums.percona.com/t/how-to-use-percona-toolkit-in-a-docker-container/7883/4 "2022-03-23T12:38:17Z")

</div>

Ok I found out that if you use the Dockerfile in [percona-docker/Dockerfile at main · percona/percona-docker · GitHub](https://github.com/percona/percona-docker/blob/main/percona-toolkit/Dockerfile) 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`.

---

<div class="post-metadata">

**Author:** ![nunop](https://avatars.discourse-cdn.com/v4/letter/n/5fc32e/32.png) [@nunop](https://forums.percona.com/u/nunop)\
**Post date:** [March 10, 2024, 4:27am UTC](https://forums.percona.com/t/how-to-use-percona-toolkit-in-a-docker-container/7883/6 "2024-03-10T04:27:47Z")

</div>

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

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

```auto
  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._
