Docker in an LXC

MimCom

Active Member
Apr 22, 2011
204
3
38
Southwest NM
We have a couple of apps we need to deploy which are being provided as Docker images (no other options currently available from the developers. We would prefer (strongly) to run them in LXC on Proxmox.

http://stackoverflow.com/questions/22085657/can-docker-run-inside-a-linux-container has some suggestions I'd like to try. Is there a way to create/run an unconfined LXC via Proxmox, or to allow nesting? What happens when I start editing config files -- will PVE overwrite those, or cause other conflicts?

thank you~
 
There is a lengthy discussion in the forums about this topic without any conclusion. Maybe it works, maybe not, but I strongly recommend to use just boot2docker inside a KVM VM and run docker in there. Simple setup.

Hopefully, we will have docker-machine support for Proxmox VE eventually and can use it directly to provision docker on Proxmox VE.
 
Very low powered nodes here, so I was hoping to avoid KVM. Had not heard of boot2docker. Downloads on boot2docker.io are for Windows and OS X. Building an ISO apparently depends on Docker. https://github.com/dhiltgen/docker-machine-kvm perhaps?

+1 for Docker support under Proxmox, or at least a shim layer that will allow it it to peacefully coexist in an LXC.
 
boot2docker are two projects, the one you mentioned is the client part which downloads the server part that is on:
https://github.com/boot2docker/boot2docker/releases

Docker will - according to the Proxmox VE developers - not going to be a part of Proxmox VE. Which is totally clear, because docker is a PaaS and Proxmox VE is a IaaS. The logical way is - and docker-machine itself implements this - to use a hypervisor and run docker on top of it. The docker-machine driver you mentioned is the KVM one using libvirt which is not compatible with Proxmox VE.
 
Thanks, Bill. I've been following the Docker discussions here for some time and understand the lack of a fit between SAAS and Proxmox. I just really prefer containers.

I downloaded boot2docker.iso from the release page and booted it in a KVM. Installer script depends on bash, which is not installed. Trying to run the script in busybox (by changing the shell to /bin/sh) breaks when it tries to call getent and useradd.
 
Last edited:
I have to say that I've never installed boot2docker manually, only through docker-machine, but I think there is some external mechanism to install it in unattended mode.
 
Slightly OT, but for those looking for possibility to have PVE+Docker on single host, there was interesting article on ServeTheHome recently.

From what I understand, it does not run Docker-engine on LXC/VM but on host, in addition to KVM/LXC. The only drawback is having separate GUIs for KVM/LXC (Proxmox) and Docker (Portainer)...
 
I have a report of Docker installing successfully and running well in an LXC (Ubuntu 16.04 container on Ubuntu 17.04 host with LXC version 2.17).

Is there a roadmap for this LXC update in PVE?

thank you~
 
I have a report of Docker installing successfully and running well in an LXC (Ubuntu 16.04 container on Ubuntu 17.04 host with LXC version 2.17).

Is there a roadmap for this LXC update in PVE?

thank you~

I'm currently running PVE 5.0-30 and just followed the instructions at [0] and was able to run Docker images inside a LXC container. When running your LXC containers unprivileged you may run into issues with the apparmor profiles though. In this case you basically have three options.

- Create your own local apparmor profiles [1]
- Disable apparmor (e. g. docker run --security-opt apparmor=unconfined -i -t ubuntu:16.04 /bin/bash)
- Run Docker inside a privileged LXC container

Probably not something I would use in production but for testing/development this is certainly a nice way to go.


[0] https://www.solaris-cookbook.eu/virtualisation/proxmox/proxmox-lxc-running-docker-inside-container/
[1] https://docs.docker.com/engine/security/apparmor/
 
Yes, it will work unconfined -- but that kind of defeats the purpose of running LXCs.

I am still curious about the roadmap for LXC updates.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!