Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

linux container display wrong information

Tags:

docker

lxc

*i start the linux container in docker with specific cpus *

typing command 'cat /proc/cpuinfo in my container, container shows full specification of laptop instead of only container. why this can v happened ?

like image 857
user3247089 Avatar asked Feb 18 '26 03:02

user3247089


1 Answers

LXC doesn't provide a virtualized kernel -- the kernel is shared between the host and all containers. So when you look at the /proc file system, you (often) see what the kernel sees and not the limits of the container.

You can limit your container to run on specific CPUs, but I don't know a way to deceive your container into thinking that there are no other CPUs on the system.

In a similar way, top running in a container will show you the full RAM available on the host, even if you limit the memory of the container.

I don't know a way for a container to learn its own limits, but from the host you can gather many metrics. See http://blog.docker.io/2013/10/gathering-lxc-docker-containers-metrics/

like image 135
Andy Avatar answered Feb 20 '26 18:02

Andy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!