On 01/12/2022 21:48, Laurence Perkins wrote:
I’m setting up an image to use Docker, which will be deployed on multiple machines.  Since the containers will be large, I didn’t want them on the root partition.

Ok, easy enough, I just put it in fstab to mount a different partition on /var/lib/docker.  Presto, now I don’t have to worry about a container using up all the OS’s disk space.

I don't know what's wrong in your case, but in order to have docker store its files elsewhere, I created this file:

  /etc/docker/daemon.json

with this in it:

  {
      "data-root": "/mnt/Data/cache/docker"
  }

I stopped the docker daemon and did:

  mkdir /mnt/Data/cache/
  mv /var/lib/docker /mnt/Data/cache/

as root. Then started the docker daemon again and it worked.

/etc/docker/daemon.json is useful for other settings as well, like enabling BuildKit by default without having to specify it on the command line every time. I use:

  {
      "data-root": "/mnt/Data/cache/docker",
      "features": { "buildkit": true }
  }


Reply via email to