Gentoo Archives: gentoo-user

From: Laurence Perkins <lperkins@×××××××.net>
To: "gentoo-user@l.g.o" <gentoo-user@l.g.o>
Subject: [gentoo-user] Docker mounting strangeness.
Date: Thu, 01 Dec 2022 19:48:40
Message-Id: MW2PR07MB4058881FF41F3BE4D9DE0964D2149@MW2PR07MB4058.namprd07.prod.outlook.com
1 Starting here in case it’s something specific to Gentoo since I can’t find anybody complaining about the behaviour elsewhere on the web.
2
3 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.
4
5 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.
6
7 That’s where it gets weird.
8
9 Deploy the image, boot it up, everything is mounted correctly. But the first time (and ONLY the first time) I start Docker it somehow remounts the OS partition onto /var/lib/docker, and I end up with:
10
11 # lsblk
12 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
13 sda 8:0 0 250G 0 disk
14 ├─sda1 8:1 0 123M 0 part /boot/efi
15 ├─sda2 8:2 0 3.8G 0 part
16 ├─sda3 8:3 0 14.2G 0 part /var/lib/docker
17 │ /
18 ├─sda4 8:4 0 19.2G 0 part /var/opt
19 ├─sda5 8:5 0 9.5G 0 part
20 └─sda6 8:6 0 203.1G 0 part /var/lib/docker
21
22 It puts all of Docker’s files on the OS partition at that point. (⊙.☉)7
23
24 But if I turn Docker off, unmount everything from /var/lib/docker, and then remount just sda6 to /var/lib/docker, then when I restart Docker it puts everything on sda6 for me like I wanted, and continues to do so on reboots and Docker restarts after that…
25
26 Everything I find on the web is about how mounting stuff on /var/lib/docker *inside* a container will cause all kinds of problems… But that’s not what I’m doing… If it mangled the mounts every time, I could understand that too. But this seems strange. Is there some magic button I’m supposed to push to tell it not to mess with its data dir?
27
28 Running OpenRC by the way, if that makes a difference.
29
30 LMP

Replies

Subject Author
[gentoo-user] Re: Docker mounting strangeness. Nikos Chantziaras <realnc@×××××.com>