Docker on LXC showing host resources

encore

Well-Known Member
May 4, 2018
108
1
58
36
Hi guys,

I see a strange behaviour when running Docker on LXC.
We are setting the following additional config options to be able to start Docker containers inside of LXC containers:
Code:
lxc.cgroup.devices.allow: c 10:200 rwm
lxc.apparmor.profile: unconfined
lxc.cap.drop:

When checking the memory or cpu from inside the Docker container on the LXC container, we are always seeing the resources of the host, not the ones that we assigned to the LXC container. Checking the config documentation for the options we've set, I am not able to see which of the options could cause that: https://linuxcontainers.org/lxc/manpages/man5/lxc.container.conf.5.html

The LXC container itself shows the correct resources when checking /proc/cpuinfo or /proc/meminfo.
Running "htop" on the LXC container shows some strange values as well though. On a container that has 4 GB memory assigned to it and no swap, it shows a usage of "8 GB of 4 GB in use" directly after starting the container.

Any ideas what might cause this behaviour and how to fix it?

Thank you!
 
Hi.
I'm just starting out with Proxmox VE 8 and I've encountered the same issue in a Debian12 LXC container.
My Host PVE server has 8 cores and 32 GiB of RAM
Inside the Guest Debian12 I see the correct numbers of CPU cores (4) and correct amount of RAM (16 GiB) - for example running free -m or htop
But inside a debian docker container the memory being reported is 32 GiB / CPU 8 cores. The values from the host PVE Server.

I'm guessing this has to do with the nesting, but is there a setting I'm missing to report the correct RAM/CPU values within docker ?
Thank you very much.

Here is my LXC config :
Code:
#cat /etc/pve/lxc/151.conf
arch: amd64
cores: 4
features: keyctl=1,nesting=1
hostname: DevDeb12
memory: 16000
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=EA:EC:DE:F4:09:B3,ip=dhcp,type=veth
onboot: 1
ostype: debian
rootfs: local-lvm:vm-151-disk-0,size=40G
startup: up=10
swap: 512
unprivileged: 1
 
Last edited:

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!