LXC / Container Notes/Tips

To resolve error: “ERROR: Unable to fetch GPG key from keyserver”

DOWNLOAD_KEYSERVER="pgp.mit.edu" lxc-create -t download ...

Use ZFS backing store

lxc-create -n foo -t download -B zfs --zfsroot=tank/lxc

gpg —keyserver hkp://keyserver.ubuntu.com:80 —search foo

Migrate LXC (unpriviledged) containers

Shutdown container(s) at source then run:

rsync -avhz --progress --numeric-ids user@host:/var/lib/lxc/<ctname> /var/lib/lxc/<ctname>

if the target is not empty you may need to add “—delete” switch to rsync.

Now you can start containers at destination!

Running Docker inside Unpriviledged LXC Container

Check this link which says that latest version of docker can run inside unpriviledged lxc containers.

Tested container images (running fine inside unpriv lxc)

uptime-kuma

docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1

CloudBeaver

docker run --name cloudbeaver --rm -ti -p 8080:8978 -v /var/cloudbeaver/workspace:/opt/cloudbeaver/workspace dbeaver/cloudbeaver:latest

Gen Info

this mailing list entry describes how bind mounts actually work

Create a Fedora Container/rootfs and import into docker

mkdir /tmp/myimage
dnf --releasever=23 --installroot=/tmp/myimage install <package-name>
rm -rf /tmp/myimage/var/cache/dnf
tar zcvf - /tmp/myimage | docker import - myimage

JVM and Container Limits

For JDK8 specify following:

java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap

See JVM page for more info.