imriss
imriss

Reputation: 1971

How use valgrind to check memory leak of docker when called via docker-compose

I would like to check for potential memory leaks of a number of containers running via docker-compose and a YAML file.

When valgrind is called using the following command:

valgrind --log-file=/tmp/debug.log \ --trace-children=yes \ --track-origins=yes docker-compose -f docker-compose.yml up --build -d the valgrind stops tracing when the docker-compose finishes with setting up the containers; it does not trace the docker calls that docker-compose has performed.

Is there a way to make valgrind continue to check the memory activity of the docker when it is called via docker-compose?

Thanks

Upvotes: 0

Views: 5519

Answers (1)

Constantin Galbenu
Constantin Galbenu

Reputation: 17683

I don't think this is possible because the docker calls (like run) are in fact sent over a socket as commands (/var/run/docker.sock). Then, those commands are in fact run by the docker daemon, which is a different process, already started when you run valgrind ....

What you can do is to install valgrind inside the container itself and make sure that it starts the main process, by replacing the CMD command.

Upvotes: 3

Related Questions