*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 ?
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With