SlideShare a Scribd company logo
Containers: What are they, Really?
Containers: What are they, Really?
Containers: What are they, Really?
Containers: What are they, Really?
●
●
●
Containers: What are they, Really?
Containers: What are they, Really?
+ run input commands with arguments
++ add hostname limitations
+++ add process ID limitations
++++ add mount/filesystem limitations
func main() {
switch os.Args[1] {
case "run":
run()
default:
panic("what?")
}
}
func run() {
fmt.Printf("running %vn", os.Args[2:])
cmd := exec.Command(os.Args[2],
os.Args[3:]...)
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
must(cmd.Run())
}
func must(err error) {
if err != nil {
panic(err)
}
}
---- take inputs and executes them
---- panics with non-”run” command
🎉 And it successfully echoes “Hello”!
----- opens shell to “container process”
------ can check hostname
------ can CHANGE hostname!!!
Containers: What are they, Really?
Containers: What are they, Really?
func run() {
fmt.Pintf("running %vn", os.Args[2:])
cmd := exec.Command(os.Args[2],
os.Args[3:]...)
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
cmd.SysProcAttr = &syscall.SysProcAttr{
Cloneflags: syscall.CLONE_NEWUTS,
}
must(cmd.Run())
}
cmd will be executed with linux flag for calling a child process, which runs in a new UTS
namespace
can see all processes on the host
machine
func run() {
fmt.Printf("running %vn", os.Args[2:])
cmd := exec.Command(os.Args[2],
os.Args[3:]...)
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
cmd.SysProcAttr = &syscall.SysProcAttr{
Cloneflags: syscall.CLONE_NEWUTS |
syscall.CLONE_NEWPID,
}
must(cmd.Run())
}
why can we still the parent namespace?
----- execute cmd in new PID and new UTS namespace
func run() {
cmd := exec.Command("/proc/self/exe", append([]string{"child"},
os.Args[2:]...)...)
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
cmd.SysProcAttr = &syscall.SysProcAttr{
Cloneflags: syscall.CLONE_NEWUTS | syscall.CLONE_NEWPID,
}
must(cmd.Run())
}
func child() {
fmt.Printf("running %v as pid %vn", os.Args[2:], os.Getpid())
cmd := exec.Command(os.Args[2], os.Args[3:]...)
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
must(cmd.Run())
}
----- let’s try this again but fork off a child process
----- child process has a PID of one!
can still see processes on host machine
‘ps’ is looking in the /proc directory
func run() {
md := exec.Command("/proc/self/exe", append([]string{"child"},
os.Args[2:]...)...) // link to currently running process
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
cmd.SysProcAttr = &syscall.SysProcAttr{
Cloneflags: syscall.CLONE_NEWUTS | syscall.CLONE_NEWPID |
syscall.CLONE_NEWNS,
}
must(cmd.Run())
}
------ NEWNS flag for mount namespace is creating a
“mount table” for the process, allowing it to have it’s own
filesystem
Containers: What are they, Really?
func child() {
fmt.Printf("running %v as pid%vn", os.Args[2:], os.Getpid())
cmd := exec.Command(os.Args[2], os.Args[3:]...)
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
must(syscall.Chroot("/home/rootfs"))
must(os.Chdir("/"))
must(syscall.Mount("proc", "proc", "proc", 0, ""))
must(cmd.Run())
}
TODO
Need a new root filsystem
w/ empty /proc directory
Containers: What are they, Really?
● ✔
● ✔
●
● ✔
●
●
●
●
●
●
●
●
●
●
●
●
Source: https://docs.docker.com/engine/understanding-docker/
https://coreos.com/rkt/docs/latest/rkt-vs-other-projects.html#rkt-vs-docker
docker ecosystem
Source: https://github.com/nkhare/container-orchestration/blob/master/kubernetes/README.md
GKE
DigitalOcean k8s
CNCF (cloud native computing foundation)
Questions?
●
●
, Julien Friedman
● My demo code - @si74 on github
● An overview of the docker ecosystem
Containers: What are they, Really?

More Related Content

PDF
Networking and Go: An Engineer's Journey (Strangeloop 2019)
PDF
What Have Syscalls Done for you Lately?
PDF
Containers: The What, Why, and How
PDF
Docker / Ansible
PDF
Declare your infrastructure: InfraKit, LinuxKit and Moby
PDF
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
PPTX
Practical Glusto Example
PPTX
Container & kubernetes
Networking and Go: An Engineer's Journey (Strangeloop 2019)
What Have Syscalls Done for you Lately?
Containers: The What, Why, and How
Docker / Ansible
Declare your infrastructure: InfraKit, LinuxKit and Moby
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
Practical Glusto Example
Container & kubernetes

What's hot (20)

PDF
Object Storage with Gluster
PDF
Small, Simple, and Secure: Alpine Linux under the Microscope
PDF
CoreOS intro
PDF
How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...
PDF
Devinsampa nginx-scripting
PPTX
Ansible as a better shell script
PDF
Docker n co
PDF
Monitoring with Syslog and EventMachine
PDF
Node.js - A Quick Tour
PDF
Docker and friends at Linux Days 2014 in Prague
ODP
nginx: writing your first module
ODP
Testing Wi-Fi with OSS Tools
PDF
CoreOS Overview
PDF
Who is afraid of privileged containers ?
PPTX
Git/Github/Bitbucket@TalkIt. Humber college.
PPTX
Native Containers on Windows 10 & Windows Server 2016 using Docker
PDF
Kubernetes in 20 minutes - HDE Monthly Technical Session 24
PPTX
Container Torture: Run any binary, in any container
PPTX
Lessons from running potentially malicious code inside containers
PDF
Docker command
Object Storage with Gluster
Small, Simple, and Secure: Alpine Linux under the Microscope
CoreOS intro
How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...
Devinsampa nginx-scripting
Ansible as a better shell script
Docker n co
Monitoring with Syslog and EventMachine
Node.js - A Quick Tour
Docker and friends at Linux Days 2014 in Prague
nginx: writing your first module
Testing Wi-Fi with OSS Tools
CoreOS Overview
Who is afraid of privileged containers ?
Git/Github/Bitbucket@TalkIt. Humber college.
Native Containers on Windows 10 & Windows Server 2016 using Docker
Kubernetes in 20 minutes - HDE Monthly Technical Session 24
Container Torture: Run any binary, in any container
Lessons from running potentially malicious code inside containers
Docker command
Ad

Similar to Containers: What are they, Really? (20)

PPTX
04_ForkPipe.pptx
PDF
Process management
PDF
Systems Programming Assignment Help - Processes
PPT
process creation OS
PPTX
Zurg part 1
PPTX
Linux container internals
DOCX
httplinux.die.netman3execfork() creates a new process by.docx
PDF
Os lab final
PPTX
Unix-module4.Unit 2 Virtualization Part I.pptx
PDF
Tested on ubuntu,Linux#include stdio.h #include string.h.pdf
PPTX
Linux Systems Programming: Process CommunCh11 Processes and Signals
DOCX
LP-Unit3.docx
PDF
TDC2017 | São Paulo - Trilha Containers How we figured out we had a SRE team ...
PPTX
UNIX_Process Control_Module3.pptx
PPTX
Process management
PDF
MyShell - English
PDF
System calls
DOCX
Write a C program called pross-c to implement the UNIX-Linux equivalen.docx
04_ForkPipe.pptx
Process management
Systems Programming Assignment Help - Processes
process creation OS
Zurg part 1
Linux container internals
httplinux.die.netman3execfork() creates a new process by.docx
Os lab final
Unix-module4.Unit 2 Virtualization Part I.pptx
Tested on ubuntu,Linux#include stdio.h #include string.h.pdf
Linux Systems Programming: Process CommunCh11 Processes and Signals
LP-Unit3.docx
TDC2017 | São Paulo - Trilha Containers How we figured out we had a SRE team ...
UNIX_Process Control_Module3.pptx
Process management
MyShell - English
System calls
Write a C program called pross-c to implement the UNIX-Linux equivalen.docx
Ad

More from Sneha Inguva (8)

PDF
Handy Networking Tools and How to Use Them
PDF
MicroCPH: Observability and Product Release
PDF
[Power To Fly Webinar] Observability at a Cloud Provider
PDF
Networking and Go: An Epic Journey
PDF
observability pre-release: using prometheus to test and fix new software
PDF
Observability and Product Release
PDF
Prometheus Everything, Observing Kubernetes in the Cloud
PDF
Observability in a Dynamically Scheduled World
Handy Networking Tools and How to Use Them
MicroCPH: Observability and Product Release
[Power To Fly Webinar] Observability at a Cloud Provider
Networking and Go: An Epic Journey
observability pre-release: using prometheus to test and fix new software
Observability and Product Release
Prometheus Everything, Observing Kubernetes in the Cloud
Observability in a Dynamically Scheduled World

Recently uploaded (20)

PPTX
ai tools demonstartion for schools and inter college
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PPTX
ISO 45001 Occupational Health and Safety Management System
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
medical staffing services at VALiNTRY
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
top salesforce developer skills in 2025.pdf
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PPTX
Online Work Permit System for Fast Permit Processing
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Transform Your Business with a Software ERP System
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
CHAPTER 2 - PM Management and IT Context
PPT
Introduction Database Management System for Course Database
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
Introduction to Artificial Intelligence
ai tools demonstartion for schools and inter college
How Creative Agencies Leverage Project Management Software.pdf
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
ISO 45001 Occupational Health and Safety Management System
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
medical staffing services at VALiNTRY
Which alternative to Crystal Reports is best for small or large businesses.pdf
top salesforce developer skills in 2025.pdf
Odoo Companies in India – Driving Business Transformation.pdf
ManageIQ - Sprint 268 Review - Slide Deck
Online Work Permit System for Fast Permit Processing
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Transform Your Business with a Software ERP System
L1 - Introduction to python Backend.pptx
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
CHAPTER 2 - PM Management and IT Context
Introduction Database Management System for Course Database
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Introduction to Artificial Intelligence

Containers: What are they, Really?

  • 8. + run input commands with arguments ++ add hostname limitations +++ add process ID limitations ++++ add mount/filesystem limitations
  • 9. func main() { switch os.Args[1] { case "run": run() default: panic("what?") } } func run() { fmt.Printf("running %vn", os.Args[2:]) cmd := exec.Command(os.Args[2], os.Args[3:]...) cmd.Stdin = os.Stdin cmd.Stderr = os.Stderr cmd.Stdout = os.Stdout must(cmd.Run()) } func must(err error) { if err != nil { panic(err) } } ---- take inputs and executes them ---- panics with non-”run” command
  • 10. 🎉 And it successfully echoes “Hello”!
  • 11. ----- opens shell to “container process” ------ can check hostname ------ can CHANGE hostname!!!
  • 14. func run() { fmt.Pintf("running %vn", os.Args[2:]) cmd := exec.Command(os.Args[2], os.Args[3:]...) cmd.Stdin = os.Stdin cmd.Stderr = os.Stderr cmd.Stdout = os.Stdout cmd.SysProcAttr = &syscall.SysProcAttr{ Cloneflags: syscall.CLONE_NEWUTS, } must(cmd.Run()) } cmd will be executed with linux flag for calling a child process, which runs in a new UTS namespace
  • 15. can see all processes on the host machine
  • 16. func run() { fmt.Printf("running %vn", os.Args[2:]) cmd := exec.Command(os.Args[2], os.Args[3:]...) cmd.Stdin = os.Stdin cmd.Stderr = os.Stderr cmd.Stdout = os.Stdout cmd.SysProcAttr = &syscall.SysProcAttr{ Cloneflags: syscall.CLONE_NEWUTS | syscall.CLONE_NEWPID, } must(cmd.Run()) } why can we still the parent namespace? ----- execute cmd in new PID and new UTS namespace
  • 17. func run() { cmd := exec.Command("/proc/self/exe", append([]string{"child"}, os.Args[2:]...)...) cmd.Stdin = os.Stdin cmd.Stderr = os.Stderr cmd.Stdout = os.Stdout cmd.SysProcAttr = &syscall.SysProcAttr{ Cloneflags: syscall.CLONE_NEWUTS | syscall.CLONE_NEWPID, } must(cmd.Run()) } func child() { fmt.Printf("running %v as pid %vn", os.Args[2:], os.Getpid()) cmd := exec.Command(os.Args[2], os.Args[3:]...) cmd.Stdin = os.Stdin cmd.Stderr = os.Stderr cmd.Stdout = os.Stdout must(cmd.Run()) } ----- let’s try this again but fork off a child process
  • 18. ----- child process has a PID of one! can still see processes on host machine ‘ps’ is looking in the /proc directory
  • 19. func run() { md := exec.Command("/proc/self/exe", append([]string{"child"}, os.Args[2:]...)...) // link to currently running process cmd.Stdin = os.Stdin cmd.Stderr = os.Stderr cmd.Stdout = os.Stdout cmd.SysProcAttr = &syscall.SysProcAttr{ Cloneflags: syscall.CLONE_NEWUTS | syscall.CLONE_NEWPID | syscall.CLONE_NEWNS, } must(cmd.Run()) } ------ NEWNS flag for mount namespace is creating a “mount table” for the process, allowing it to have it’s own filesystem
  • 21. func child() { fmt.Printf("running %v as pid%vn", os.Args[2:], os.Getpid()) cmd := exec.Command(os.Args[2], os.Args[3:]...) cmd.Stdin = os.Stdin cmd.Stderr = os.Stderr cmd.Stdout = os.Stdout must(syscall.Chroot("/home/rootfs")) must(os.Chdir("/")) must(syscall.Mount("proc", "proc", "proc", 0, "")) must(cmd.Run()) } TODO Need a new root filsystem w/ empty /proc directory
  • 23. ● ✔ ● ✔ ● ● ✔ ● ●
  • 31. CNCF (cloud native computing foundation)
  • 33. ● ● , Julien Friedman ● My demo code - @si74 on github ● An overview of the docker ecosystem