Imported LXD container breaks nested docker Instance

Hi

If you are interested in using existing ZFS pools because dir storage type isn’t optimal, you could also attach a second disk as type block created via sudo zfs create... at a generic mount-point within the container, which is formatted with EXT4 or others that are supported by Docker. You then bind mount directories on that second disk to the default locations for docker so they sit on the attached disk.

The Docker Swarm feature is problematic in a container based on what I’ve read and the issues that others and myself are experiencing. Sad and I think for now that Docker Swarm needs to live in VMs.

E.g. zfs create, note not using LXD’s structure:

sudo zfs create -p -s -V 50GB storagepoolname/acme-custom/block/instancename_disk01

E.g. formatting the block device (zvol):

sudo mkfs.ext4 /dev/zvol/storagepoolname/acme-custom/block/instancename_disk01

E.g. correcting permissions:

sudo mount /dev/zvol/storagepoolname/acme-custom/block/instancename_disk01 /mnt
sudo mkdir -p /mnt/etc/docker /mnt/var/lib/{docker,docker-bootstrap,docker-certs,docker-engine}
sudo chown -R 1000000:1000000 /mnt/
sudo umount /mnt

E.g. container config:

devices:
  disk01:
    path: /mnt/disk01
    source: /dev/zvol/storagepoolname/acme-custom/block/instancename_disk01
    type: disk

E.g. container /etc/fstab:

/mnt/disk01/etc/docker /etc/docker none bind,auto 0 0
/mnt/disk01/var/lib/docker /var/lib/docker none bind,auto 0 0
/mnt/disk01/var/lib/docker-bootstrap /var/lib/docker-bootstrap none bind,auto 0 0
/mnt/disk01/var/lib/docker-certs /var/lib/docker-certs none bind,auto 0 0
/mnt/disk01/var/lib/docker-engine /var/lib/docker-engine none bind,auto 0 0

References:

Hope this may help.

1 Like