Un viaggio alla scoperta di funzionalità che il kernel Linux offre sfruttate da Docker per creare il suo impero e fornire le funzionalità e i benefici ad alto livello. Vedremo live come è facile creare dei CGroups su distro Linux per avere un controllo di un processo, come gestire branches del filesystem, e come dare namespaces per isolare un semplice processo creato da noi. Attenzione verranno mostrati script. sh e un po' di codice in Go. Fatti un Docker tutto tuo!
5. “I once heard that hypervisors
are the living proof of operating
system's incompetence”
-- Glauber Costa's - LinuxCon Europe 2012
@liuggio Giulio De Donato
6. ... containers ...
“I would love to say months,
but let's get realistic”
-- Glauber Costa's - LinuxCon Europe 2012
@liuggio Giulio De Donato
15. NAMESPACE
Linux 2.6.23 (released in late 2007)
6 namespaces
- mnt (mount points, filesystems)
- pid (processes tree)
- net (network stack)
- ipc (System V IPC)
- uts (hostname)
- user (UIDs)
Namespaces started in about
2002.
@liuggio Giulio De Donato
16. Namespaces processes API
consists of these 3 system calls:
● clone() - creates a new process and a new namespace; the
newly created process is attached to the new namespace
● unshare()–gets only a single parameter, flags. Does not create a
new process; creates a new namespace and attaches the calling
processto it.
● setns()- a new system call, for attaching the calling process to
an existing namespace;
@liuggio Giulio De Donato
20. CGroups!
The cgroup (control groups) subsystem is a Resource Management and Resource
Accounting/Tracking solution, providing a generic process - grouping framework
It handles resources such as memory, cpu, network, and more;
mostly needed in both ends of the spectrum (servers and embedded).
∎ Development was started by engineers at Google in 2006 under the name "process containers”
∎ Merged into kernel 2.6.24 (2008).
∎ cgroup core has 3 maintainers, and each cgroup controller has its own maintainer (cpu memory io)
@liuggio Giulio De Donato
27. Union File System
PRO
- File level
- No caches
CONS
- Bad performance for big files
- Not in kernel
- Too much layers costs
● merge into a single directory 2 devices
● Combining a large, read-only file system with small write area (like livecd)
@liuggio Giulio De Donato
28. ZFS is a combination of a volume manager (like LVM) and a filesystem (like ext4, xfs, or btrfs).
ZFS one of the most beloved features of Solaris, universally coveted by every Linux sysadmin with a Solaris background.
● snapshots
● copy-on-write cloning
● continuous integrity checking against data corruption
● automatic repair
● efficient data compression
2016
@liuggio Giulio De Donato