for-linux icon indicating copy to clipboard operation
for-linux copied to clipboard

Docker and Overlayroot on Ubuntu

Open DavidJMSD opened this issue 5 years ago • 3 comments

Has anyone gotten overlayroot and docker to work together? I'm running Ubuntu 18.04.3LTS and docker daemon won't start up.

Specifically:

sudo apt-get install docker.io overlayroot

sudo docker ps #works, no errors.

Edit /etc/overlayroot.conf to change: overlayroot="" to overlayroot="tmpfs"

sudo update-initramfs -u

sudo reboot #to reboot into the read only overlay filesystem

sudo docker ps # Get the following error:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

ps: to remove the overlay filesystem do the following:

sudo overlayroot-chroot

Edit that same file to put it back to the original.

sudo update-initramfs -u

exit #to exit the chroot environment

sudo reboot #your system is back to a normal read/write Ubuntu system and "sudo docker ps" works again.

docker

DavidJMSD avatar Sep 04 '19 01:09 DavidJMSD

Solved my own problem.

  1. Docker uses an overlay2 file system in /var/lib/docker.
  2. An overlay2 filesystem cannot be used on an overlay file system that overlayroot uses. It can however reside on it as regular files. So my solution was to:
  3. make a copy of /var/lib/docker/overlay2.
  4. Mount a tmpfs on /var/lib/docker/overlay2
  5. On boot - copy that copy of /var/lib/docker/overlay2 to that tmpfs.
  6. Start up docker. Docker now sees it on an tmpfs, not an overlay file system.

DavidJMSD avatar Sep 04 '19 19:09 DavidJMSD

I'm running into issues with docker and overlayroot and I would love more detail on this solution;

  • When you say 'mount a tmpfs on /var/lib/docker/overlay2' are you referring to overlayroot?
  • I'm constrained to use aufs instead of overlay2, hoping a similar solution will work. If you have any tips or experience I'd love to hear it.

Thx!

weeotch avatar Jan 02 '20 19:01 weeotch

Another solution might be using a different storage driver for docker. This can be configured in /etc/docker/daemon.json (see https://docs.docker.com/storage/storagedriver/select-storage-driver/)

I have tried fuse-overlayfs on top of my overlayroot, and it seems to work fine.

abaumfalk avatar Jan 02 '24 15:01 abaumfalk