Search code examples
dockermacoscolima

Colima runtime on macOS: /var/lib/docker/overlay2/ : No such file or directory (os error 2)


I am getting the error "/var/lib/docker/overlay2/": No such file or directory (os error 2)" when trying to run a Docker container on macOS using the Colima runtime.

I have tried adding "storage-driver": "devicemapper" to my /Users/username/.docker/daemon.json file, but this did not fix the issue.

Here are the details of my setup:

Machine: macOS 12.4 (Monterey) with the arm64 architecture Colima runtime: 0.5.5 Docker client: 23.0.2 Docker server: 20.10.20 Here are the steps I am taking to reproduce the issue:

run the docker image

docker run --rm -d -ti ubuntu:22.04 bash  

Run the following command to inspect the image:

docker inspect image-id -f '{{.GraphDriver.Data.LowerDir}}'
/var/lib/docker/overlay2/image-id-init/diff:/var/lib/docker/overlay2/image-id/diff

Run the following command to list the contents of the /var/lib/docker/overlay2 directory:

ls /var/lib/docker/overlay2

If you see the following error message, then you are experiencing the same issue as me:

ls: cannot access /var/lib/docker/overlay2: No such file or directory

I have tried the following troubleshooting steps, but none of them have worked:

  • I have restarted my machine, docker
  • I have restarted Colima.
  • I have run command docker system prune -a
  • I have added "storage-driver": "devicemapper" to my /Users/username/.docker/daemon.json

Can anyone help me to troubleshoot this issue?

I tried

ls /var/lib/docker/overlay2/ 

And I expect list of layers


Solution

  • I found the answer to my question, after digging and checking with Colima maintainers.

    So the takeaway is that I need to run colima ssh

    everything is inside the Colima instance not my MacOS host, that was tricky