Gentoo Archives: gentoo-user

From: Nikos Chantziaras <realnc@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: Docker mounting strangeness.
Date: Fri, 02 Dec 2022 15:10:18
Message-Id: tmd4gb$6tj$1@ciao.gmane.io
In Reply to: [gentoo-user] Docker mounting strangeness. by Laurence Perkins
1 On 01/12/2022 21:48, Laurence Perkins wrote:
2 > I’m setting up an image to use Docker, which will be deployed on
3 > multiple machines.  Since the containers will be large, I didn’t want
4 > them on the root partition.
5 >
6 > Ok, easy enough, I just put it in fstab to mount a different partition
7 > on /var/lib/docker.  Presto, now I don’t have to worry about a container
8 > using up all the OS’s disk space.
9
10 I don't know what's wrong in your case, but in order to have docker
11 store its files elsewhere, I created this file:
12
13 /etc/docker/daemon.json
14
15 with this in it:
16
17 {
18 "data-root": "/mnt/Data/cache/docker"
19 }
20
21 I stopped the docker daemon and did:
22
23 mkdir /mnt/Data/cache/
24 mv /var/lib/docker /mnt/Data/cache/
25
26 as root. Then started the docker daemon again and it worked.
27
28 /etc/docker/daemon.json is useful for other settings as well, like
29 enabling BuildKit by default without having to specify it on the command
30 line every time. I use:
31
32 {
33 "data-root": "/mnt/Data/cache/docker",
34 "features": { "buildkit": true }
35 }