1

There is already a question on Stack Overflow about this but the accepted answer doesn't work anymore.

My Docker Desktop app is using the directory below:

/Users/guilpejon/Library/Containers/com.docker.docker/Data/vms/0/data

And docker info gives me this:

Docker Root Dir: /mnt/sda1/var/lib/docker

The question is, how do I change the Docker Root Dir to use the same directory used by the Docker Desktop app?

GuilPejon
  • 971
  • 13
  • 19
  • The `docker info` directory is inside the VM contained in the first location you show. I suspect on MacOS the `docker info` will _always_ be that exact location, but it's not related to any location on your outer host system. – David Maze Jan 03 '21 at 18:17
  • You could be right, but it's weird because my containers do not show up on Docker Desktop either, so I'm guessing it is pointing to a different directory. – GuilPejon Jan 03 '21 at 19:15

2 Answers2

0

With docker command you can use --data-root option to provide path of root directory.

Also in docker Preference > Docker Engine option you can provide configuration for docker demon in JSON config. You need to copy content from existing root directory to new directory.

For more option refer https://docs.docker.com/engine/reference/commandline/dockerd/

Nils
  • 910
  • 1
  • 9
  • 21
  • I tried to follow your suggestion but ended up doing a docker factory reset because of an error during the process. That reset actually fixed my original problem, so I documented it in the question. – GuilPejon Jan 03 '21 at 19:25
0

I tried to follow Nilesh's answer but Docker Desktop gave me an error while trying to do this:

{
  "features": {
    "buildkit": true
  },
  "experimental": false,
  "data-root": "/Users/guilpejon/Library/Containers/com.docker.docker/Data/vms/0/data"
}

On the error pop up window, I chose to reset docker to factory settings and then the Docker Root Dir changed to /var/lib/docker, which works for me.

Now I can control docker's resources through Docker Desktop app again, which is what I wanted.

GuilPejon
  • 971
  • 13
  • 19
  • Well, nevermind. This worked for a few moments but now all of my new terminal tabs are opening with Docker Root Dir "/mnt/sda1/var/lib/docker" again – GuilPejon Jan 03 '21 at 21:37