How to make Docker Desktop working with cadvisor?

Pay attention on this issue, please Issue Docker Desktop, Cadvisor and WSL · Issue #58 · vacp2p/wakurtosis · GitHub

Looks like that needs some fixes from Docker command side.

And I can’t understand what is solution for problem too now.

If I understand it correctly, this is not a Docker error

The issue describes a command that starts a container with /var/lib/docker bind-mounted to it

That path is where Docker Engine stores its data.

Docker Desktop, however, creates a Linux VM and runs Docker Engine on it.
That means Docker saves data into /var/lib/docker within the VM, and not on the host machine

Therefore, one cannot mount /var/lib/docker when using Docker Desktop

That is actually not entirely true. Even when you mount the docker socket, which is possible, you mount it from inside the VM, because Docker Desktop recognizes the intention and mount the file from inside. You can also mount /var/lib/docker when running the docker command from thw Windows host in Powershell for example. The path is a Linux path and it wouldn’t make sense on Windows, so it is easy to recognize. But you can also do it on macOS. You can mount a file from the VM as long as it does not exist on the host or not shared with the VM. For example:

docker run --rm -it -v /etc/hosts:/test.txt:ro bash cat /test.txt

This mounts the hosts file from the host, but you can run:

docker run --rm -it -v /etc/hoststest:/test.txt:ro bash cat /test.txt

which will show

cat: read error: Is a directory

because the path is created inside the VM as a directory and it will not be created on the host:

 »  ls -la /etc/hoststest
ls: /etc/hoststest: No such file or directory

But when I say VM, I mean in the docker-desktop WSL distribution.

WSL integration is special. The purpose of the WSL integration is that you can mount files from a WSL distro so you don’t need to store files on the Windows filesystem (and yes, you can use bash scripting). I only assume that it has to do something with the fact that when you run the first docker run command in a WSL distribution to mount the docker data root, it will not work because it still tries to mount the folder from the host.

So if you want to mount the docker data root in Docker desktop for Windows, you will need to run the command from the host. You could ask for supporting it from the WSL distro in the roadmap

But I guess it could also be considered as a bug, so you can try the other repo as well

I would try this one and if the developers say it is not a bug, you can try the roadmap to ask for it as a feature.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.