Setting up a Debian 10 LXC to run Docker Compose on Proxmox

That title is a doosey, writing this for a friend.

Ive been using proxmox for a while now and even more recently ive been using docker for some tasks, im still a fan of FreeBSD jails, its just that docker containers can be convenient if I’m already on Linux.

Start by creating your container, this initial setup is normal, give yourself enough RAM, CPU, and storage as you will need. And of course, use Debian 9 or 10.

Next your host needs to have some modules added, you can configure /etc/modules-load.d/modules.conf by adding the required modules below to that file.

aufs
overlay

And if you dont want to reboot to enable the changes you can run

modprobe aufs
modprobe overlay

Now that you’ve got that done, and your container is setup and not started you’re ready to continue.

Navigate to and edit the following file /etc/pve/lxc/<vid>.conf where <vid> is the id of your container. Add/modify the following lines. You can use your preferred editor for this, id recommend nano, or ee.

# Added for docker
lxc.apparmor.profile: unconfined
lxc.cgroup.devices.allow: a
lxc.cap.drop:

Great! Now you can start, and then enter the LXC

pct start <vid>
pct enter <vid>

Add some requirements for docker and the docker repository.

# Add some required packages
apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common

# add the docker repository
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

Install with

apt update 
apt install docker-ce

Update the docker composer that ships with Debian, I’ve not found a package for this yet, so this is a bit of a workaround.

curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

chmod +x /usr/local/bin/docker-compose

And add /usr/local/bin to the path by adding

# add the following line to ~/.bashrc
PATH=/usr/local/bin:$PATH

Once that’s done just exit and pct enter <vid> again.

That’s it! you’re ready to move onto the next step witch should be installing your docker container via docker compose! :3

2 thoughts on “Setting up a Debian 10 LXC to run Docker Compose on Proxmox”

Leave a Comment

Your email address will not be published. Required fields are marked *