advancedTop 100 Interview Questions

What are namespaces and cgroups, and what does each provide?

Namespaces provide isolation — each container gets its own view of PIDs, network interfaces, mount points, hostname, and IPC, so it can't see or interact with the host's or other containers' resources. Cgroups (control groups) provide resource limiting and accounting — capping how much CPU, memory, or I/O a container can consume. Namespaces answer 'what can I see', cgroups answer 'how much can I use'.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to What is the role of containerd and runc in the Docker architecture?← Back to all Docker questions