Running Docker in LXC Container
- jfdesignnet
- Linux
- May 7, 2024
Introduction
Proxmox official support always recommend to run Docker in VMs, not in LXC container for their reasons and else. However, VMs require more resources from the hypervisor and much slower compare to lxc container especially the boot speeds. Docker is container system and so is lxc, so basically you’re trying to run container inside container, or … containerception.
Now seriously, running docker in LXC is advised against by the proxmox developers. Any update on the proxmox system can change how docker in LXC behaves and blah and blah and blah. But hey, this is my hardware and my installation ☺️.
Okay, carry on, just recently, I do have some urgent task to do a quick fix for one of my django project and I need some quick development server to working on and I use tools named as fuse-overlayfs
that works pretty good to overcome the docker inside lxc issue, and below is the steps.
Installation steps
So, here is the steps to deploy docker container in lxc container on proxmox with zfs storage backend :
- Create unprivileged LXC container or CT from proxmox templates
- Enable the
fuse=1,keyctl=1,nesting=1
features in CT options settings - Run the container and install
fuse-overlayfs
You can useapt install fuse-overlayfs
if on ubuntu, orpacman -S fuse-overlayfs
if on arch andapk add fuse-overlayfs
if on alpine. - Install docker-ce and docker-compose as usual
- Add your user to docker group and reboot
- After reboot try to deploy your project using docker-compose
- Working on the project
That’s it, that’s all the steps, I can finishing my fix without problem and no observable issues could be detected with the docker performance or LXC itself.
See you next time.