* [gentoo-user] Docker mounting strangeness.
@ 2022-12-01 19:48 Laurence Perkins
2022-12-02 15:10 ` [gentoo-user] " Nikos Chantziaras
0 siblings, 1 reply; 2+ messages in thread
From: Laurence Perkins @ 2022-12-01 19:48 UTC (permalink / raw
To: gentoo-user@lists.gentoo.org
[-- Attachment #1: Type: text/plain, Size: 1910 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 5165 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* [gentoo-user] Re: Docker mounting strangeness.
2022-12-01 19:48 [gentoo-user] Docker mounting strangeness Laurence Perkins
@ 2022-12-02 15:10 ` Nikos Chantziaras
0 siblings, 0 replies; 2+ messages in thread
From: Nikos Chantziaras @ 2022-12-02 15:10 UTC (permalink / raw
To: gentoo-user
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 }
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-02 15:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-01 19:48 [gentoo-user] Docker mounting strangeness Laurence Perkins
2022-12-02 15:10 ` [gentoo-user] " Nikos Chantziaras
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox