*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 ?
*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/
When we are doing Operating system-level virtualization then kernel of an operating system allows for multiple isolated user-space instances. we can allocate Memory and CPU to each container as per your requirement. That can be done either on runtime OR post container creation. Logically all virtualization tool used to create a configuration file handle Memory and CPU usages.
You can now allocate a number of CPU shares to a container with the -c option as described here