Starting here in case it’s something specific to Gentoo since I can’t find 
anybody complaining about the behaviour elsewhere on the web.

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.

That’s where it gets weird.

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:

# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    0   250G  0 disk
├─sda1   8:1    0   123M  0 part /boot/efi
├─sda2   8:2    0   3.8G  0 part
├─sda3   8:3    0  14.2G  0 part /var/lib/docker
│                                /
├─sda4   8:4    0  19.2G  0 part /var/opt
├─sda5   8:5    0   9.5G  0 part
└─sda6   8:6    0 203.1G  0 part /var/lib/docker

It puts all of Docker’s files on the OS partition at that point.  (⊙.☉)7

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…

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?

Running OpenRC by the way, if that makes a difference.

LMP

Reply via email to