This document discusses Linux containers and Docker. It covers the key technologies that enable containers like namespaces, cgroups, and Docker internals. Namespaces isolate processes by resource like mount points, hostnames, IDS, and networks. Cgroups limit resources like memory, CPU, and disk. Docker builds on these technologies to provide tools for building, distributing, and running application containers.
15. PID namespaces
process ID number space
Nesting namespace:
PIDnamespacescanbenested:eachPIDnamespacehasaparent,
exceptfortheinitial("root")PIDnamespace.
On hostnode:
psaux|wc-l
298
Inside container:
dockerrun-it--rmcentos:centos7psaxu|wc-l
2
20. User namespaces
user credentials (user IDs and group IDs), capabilities
Still strict user mapping. Sad ...
UID1000insidecontainer->1000onhostnode
UID0 insidecontainer->0 onhostnode
etc
And dont really work ...
sudols-l/proc/1/ns/user
lrwxrwxrwx1rootroot0Nov2814:17/proc/1/ns/user->user:[4026531837]
dockerrun-it--rmcentos:centos7ls-l/proc/1/ns/user
lrwxrwxrwx1rootroot0Nov2811:18/proc/1/ns/user->user:[4026531837]
21. User namespaces - Capabilities
per-thread attribute
Used caplist:
CHOWN
DAC_OVERRIDE
FOWNER
MKNOD
NET_RAW
SETGID
SETUID
SETFCAP
SETPCAP
NET_BIND_SERVICE
SYS_CHROOT
KILL
troublesome: mount (cap_sys_admin)
25. Efficiency
isolated, but still on hostnode
cpu: native
memory: allmost native, few % shaved for accounting
network: small overhead
dics: native on volumes. overhead on layered fs
31. Typical workflow
developer:
-- write some code
-- unit test
-- commit
docker build:
-- environment test (serverspec, rspec etc)
-- functional test
-- push to registry
devops:
-- pull images and run