SlideShare ist ein Scribd-Unternehmen logo
1 von 21
Downloaden Sie, um offline zu lesen
RancherOS & Linux Kit
Sven Dowideit
Principal Software Engineer RancherOS
19 October 2017
Is a micro-Linux distro
• Linux Kernel,
• A custom init written in go,
• Uses Cloud-config to customise instances
• Has a System-Docker and a User-Docker
RancherOS
#cloud-init
rancher:
services_include:
http-proxy: true
registry-mirror: true
network:
interfaces:
eth1:
addresses:
- 10.11.11.1/24
...
Cloud-config
#cloud-init
rancher:
services:
rancher-agent-starter:
image: rancher/agent:v1.2.5
command:
http://10.10.10.168:8080/v1/scripts/22A906891A04AA99E831:1483142400000:U7MMVCDKpoYa3ngeh
fX6BPBt92k
privileged: true
environment:
- CATTLE_HOST_LABELS='magic=node'
labels:
io.rancher.os.scope: user
io.rancher.os.after: docker
restart: false
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/rancher:/var/lib/rancher
...
Cloud-config continued
One cut down System-Docker (v1.10-ish)
And the pluggable User-Docker
• v1.12.16 and up
• Can be selected using the cloud-config or on the
commandline.
Tale of two Docker daemons
First up, System-Docker - it’s from Q1 2016.
And worse, we start it 3 times to bootstrap the OS.
Each time we start a Docker daemon, we
docker load < stage/Images.tar
How RancherOS starts
Use the moby tool to compose the final runnable image or
ISO
RancherOS has been built by composing Container Images
into an Initrd since 2014
So there’s some legacy build tooling - which LinuxKit also
provides.
U
So… what can we modernise
Our 90M OS has turned into a 245M initrd.
[ 3.715450] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100
[ 3.715450]
[ 3.717145] CPU: 0 PID: 1 Comm: init Not tainted 4.9.26-rancher #1
[ 3.718061] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.10.1-1ubuntu1 04/01/2014
[ 3.719478] ffff9fd6c031fe20 ffffffffb632793c ffff9060ed820000 ffffffffb6a8d098
[ 3.720933] ffff9fd6c031fea0 ffffffffb614624d ffff9fd600000010 ffff9fd6c031feb0
[ 3.722387] ffff9fd6c031fe48 ffffffffb6c5eb28 0000000000000100 ffff9060ed830010
[ 3.723840] Call Trace:
[ 3.724382] [<ffffffffb632793c>] dump_stack+0x61/0x7d
[ 3.725189] [<ffffffffb614624d>] panic+0xd8/0x221
[ 3.725943] [<ffffffffb606c67a>] do_exit+0x4d4/0x92c
[ 3.726717] [<ffffffffb608b8f2>] ? wake_up_state+0x10/0x12
[ 3.727539] [<ffffffffb6074485>] ? signal_wake_up_state+0x2a/0x3b
[ 3.728418] [<ffffffffb606cb49>] do_group_exit+0x41/0xa2
Step 1: So we’re huge, and….
Let’s replace System-Docker with runC and Containerd,
copying the init code from LinuxKit
Next up, rip out the Eye teeth
519M inittrd
15-20 seconds just to load initrd
boot2docker in 30 seconds
Step 2: even huger-er
LinuxKit’s service cfg doesn’t share images, it lays one
down per entry
Also means we need to add overlayfs
Share images between services
383M initrd
14s to starting initrd
boot2docker in 25 seconds
Step 3: baby steps
There’s a bunch of files that were needed by System
Docker that we can remove.
Remove cruft
190M initrd
5s to get to starting init
boot2docker in 12seconds
Step 4: ok, this is fine.
use the os-config.tmpl to generate the runtime spec
no actual change in size or speed
Generate containerd spec
client, err := containerd.New(config.DefaultContainerdSocket)
ctx := namespaces.WithNamespace(context.Background(), "default")
ctr, err := client.NewContainer(ctx, serviceName,
containerd.WithNewSpec(
withService(cfg, serviceSet, service),
removeRunTmpfsMount(),
withDevicesFromSpec(spec),
withOverlay(rootfs, rwDir, workDir),
dumpSpec(serviceName+".new"),
),
)
task, err := ctr.NewTask(ctx, io, WithNoPivotRoot())
err := task.Start(ctx)
Code
rancher:
services:
nginx:
image: nginx
command: nginx -g 'daemon off;'
labels:
io.rancher.os.scope: system
io.rancher.os.after: docker
restart: always
ports:
- "80:80"
volumes_from:
volumes:
- /usr/bin/ros:/usr/bin/ros
And finally, customise
about 11 seconds to serve the first HTTP request
adding the default nginx image adds ~30M to the initrd
$ docker images nginx
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 1e5ab59102ce 7 days ago 108MB
Step N: wash cycle
dhcp is taking 3s - hard-code the IP
start nginx after network
use the os-console image for all os-base services
smaller, simpler LinuxKit kernel image
Lets break all the things
boot2your-service in 7 seconds
This is still RancherOS
it still uses cloud-init to load host specific settings.
(Though it can go really badly due to conference wifi :) )
Step N+1: boot2your-service
Happy hacking!
@SvenDowideit
Sven@home.org.au

Weitere ähnliche Inhalte

Was ist angesagt?

Continuous integration with Docker and Ansible
Continuous integration with Docker and AnsibleContinuous integration with Docker and Ansible
Continuous integration with Docker and Ansible
Dmytro Slupytskyi
 
CoreOS @ summer meetup in Utrecht
CoreOS @ summer meetup in UtrechtCoreOS @ summer meetup in Utrecht
CoreOS @ summer meetup in Utrecht
Timo Derstappen
 
Containers in production with Docker, CoreOS, Kubernetes and Apache Stratos
Containers in production with Docker, CoreOS, Kubernetes and Apache StratosContainers in production with Docker, CoreOS, Kubernetes and Apache Stratos
Containers in production with Docker, CoreOS, Kubernetes and Apache Stratos
Lakmal Warusawithana
 

Was ist angesagt? (20)

Continuous integration with Docker and Ansible
Continuous integration with Docker and AnsibleContinuous integration with Docker and Ansible
Continuous integration with Docker and Ansible
 
Ansible docker
Ansible dockerAnsible docker
Ansible docker
 
Virtualization inside kubernetes
Virtualization inside kubernetesVirtualization inside kubernetes
Virtualization inside kubernetes
 
Running Docker with OpenStack | Docker workshop #1
Running Docker with OpenStack | Docker workshop #1Running Docker with OpenStack | Docker workshop #1
Running Docker with OpenStack | Docker workshop #1
 
Project Atomic-Nulecule
Project Atomic-NuleculeProject Atomic-Nulecule
Project Atomic-Nulecule
 
CoreOS @ summer meetup in Utrecht
CoreOS @ summer meetup in UtrechtCoreOS @ summer meetup in Utrecht
CoreOS @ summer meetup in Utrecht
 
Containers in production with Docker, CoreOS, Kubernetes and Apache Stratos
Containers in production with Docker, CoreOS, Kubernetes and Apache StratosContainers in production with Docker, CoreOS, Kubernetes and Apache Stratos
Containers in production with Docker, CoreOS, Kubernetes and Apache Stratos
 
AtlasCamp 2015: How to deliver radical architectural change without the custo...
AtlasCamp 2015: How to deliver radical architectural change without the custo...AtlasCamp 2015: How to deliver radical architectural change without the custo...
AtlasCamp 2015: How to deliver radical architectural change without the custo...
 
Containerd: Building a Container Supervisor by Michael Crosby
Containerd: Building a Container Supervisor by Michael CrosbyContainerd: Building a Container Supervisor by Michael Crosby
Containerd: Building a Container Supervisor by Michael Crosby
 
Breaking the RpiDocker challenge
Breaking the RpiDocker challenge Breaking the RpiDocker challenge
Breaking the RpiDocker challenge
 
An Introduction to Kubernetes
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to Kubernetes
 
CoreOS Intro
CoreOS IntroCoreOS Intro
CoreOS Intro
 
Intro- Docker Native for OSX and Windows
Intro- Docker Native for OSX and WindowsIntro- Docker Native for OSX and Windows
Intro- Docker Native for OSX and Windows
 
runC: The little engine that could (run Docker containers) by Docker Captain ...
runC: The little engine that could (run Docker containers) by Docker Captain ...runC: The little engine that could (run Docker containers) by Docker Captain ...
runC: The little engine that could (run Docker containers) by Docker Captain ...
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Quantifying Container Runtime Performance: OSCON 2017 Open Container Day
Quantifying Container Runtime Performance: OSCON 2017 Open Container DayQuantifying Container Runtime Performance: OSCON 2017 Open Container Day
Quantifying Container Runtime Performance: OSCON 2017 Open Container Day
 
Kubernetes Architecture and Introduction – Paris Kubernetes Meetup
Kubernetes Architecture and Introduction – Paris Kubernetes MeetupKubernetes Architecture and Introduction – Paris Kubernetes Meetup
Kubernetes Architecture and Introduction – Paris Kubernetes Meetup
 
Kubernetes Basic Operation
Kubernetes Basic OperationKubernetes Basic Operation
Kubernetes Basic Operation
 
Deploy at scale with CoreOS Kubernetes and Apache Stratos
Deploy at scale with CoreOS Kubernetes and Apache StratosDeploy at scale with CoreOS Kubernetes and Apache Stratos
Deploy at scale with CoreOS Kubernetes and Apache Stratos
 
Net core, mssql, container und kubernetes
Net core, mssql, container und kubernetesNet core, mssql, container und kubernetes
Net core, mssql, container und kubernetes
 

Ähnlich wie Using linuxKit to build custom rancherOS systems

Ähnlich wie Using linuxKit to build custom rancherOS systems (20)

Docker 1.11 Presentation
Docker 1.11 PresentationDocker 1.11 Presentation
Docker 1.11 Presentation
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container Service
 
Collabnix Online Webinar - Demystifying Docker & Kubernetes Networking by Bal...
Collabnix Online Webinar - Demystifying Docker & Kubernetes Networking by Bal...Collabnix Online Webinar - Demystifying Docker & Kubernetes Networking by Bal...
Collabnix Online Webinar - Demystifying Docker & Kubernetes Networking by Bal...
 
Shifter: Containers in HPC Environments
Shifter: Containers in HPC EnvironmentsShifter: Containers in HPC Environments
Shifter: Containers in HPC Environments
 
Programming IoT with Docker: How to Start?
Programming IoT with Docker: How to Start?Programming IoT with Docker: How to Start?
Programming IoT with Docker: How to Start?
 
A Hitchhiker’s Guide to the Cloud Native Stack. #CDS17
A Hitchhiker’s Guide to the Cloud Native Stack. #CDS17A Hitchhiker’s Guide to the Cloud Native Stack. #CDS17
A Hitchhiker’s Guide to the Cloud Native Stack. #CDS17
 
A hitchhiker‘s guide to the cloud native stack
A hitchhiker‘s guide to the cloud native stackA hitchhiker‘s guide to the cloud native stack
A hitchhiker‘s guide to the cloud native stack
 
Docker HK Meetup - 201707
Docker HK Meetup - 201707Docker HK Meetup - 201707
Docker HK Meetup - 201707
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
 
When Docker Engine 1.12 features unleashes software architecture
When Docker Engine 1.12 features unleashes software architectureWhen Docker Engine 1.12 features unleashes software architecture
When Docker Engine 1.12 features unleashes software architecture
 
Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned  Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned
 
From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...
 
Build and run embedded apps faster from qt creator with docker
Build and run embedded apps faster from qt creator with dockerBuild and run embedded apps faster from qt creator with docker
Build and run embedded apps faster from qt creator with docker
 
Webinar: Building Embedded Applications from QtCreator with Docker
Webinar: Building Embedded Applications from QtCreator with DockerWebinar: Building Embedded Applications from QtCreator with Docker
Webinar: Building Embedded Applications from QtCreator with Docker
 
Docker Athens: Docker Engine Evolution & Containerd Use Cases
Docker Athens: Docker Engine Evolution & Containerd Use CasesDocker Athens: Docker Engine Evolution & Containerd Use Cases
Docker Athens: Docker Engine Evolution & Containerd Use Cases
 
Rooting Out Root: User namespaces in Docker
Rooting Out Root: User namespaces in DockerRooting Out Root: User namespaces in Docker
Rooting Out Root: User namespaces in Docker
 
Docker
DockerDocker
Docker
 
An Ensemble Core with Docker - Solving a Real Pain in the PaaS
An Ensemble Core with Docker - Solving a Real Pain in the PaaS An Ensemble Core with Docker - Solving a Real Pain in the PaaS
An Ensemble Core with Docker - Solving a Real Pain in the PaaS
 
Dessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudDessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloud
 
Come costruire una Platform As A Service con Docker, Kubernetes Go e Java
Come costruire una Platform As A Service con Docker, Kubernetes Go e JavaCome costruire una Platform As A Service con Docker, Kubernetes Go e Java
Come costruire una Platform As A Service con Docker, Kubernetes Go e Java
 

Mehr von Moby Project

Mehr von Moby Project (11)

Libnetwork updates
Libnetwork updatesLibnetwork updates
Libnetwork updates
 
CRI-containerd
CRI-containerdCRI-containerd
CRI-containerd
 
FaaS-and-Furious
FaaS-and-FuriousFaaS-and-Furious
FaaS-and-Furious
 
Notary - container signing
Notary - container signingNotary - container signing
Notary - container signing
 
Declare your infrastructure: InfraKit, LinuxKit and Moby
Declare your infrastructure: InfraKit, LinuxKit and MobyDeclare your infrastructure: InfraKit, LinuxKit and Moby
Declare your infrastructure: InfraKit, LinuxKit and Moby
 
Moby Summit introduction
Moby Summit introductionMoby Summit introduction
Moby Summit introduction
 
Moby and kubernetes entitlements
Moby and kubernetes entitlementsMoby and kubernetes entitlements
Moby and kubernetes entitlements
 
Builder and BuildKit
Builder and BuildKitBuilder and BuildKit
Builder and BuildKit
 
OpenWhisk and IBM cloud functions
OpenWhisk and IBM cloud functionsOpenWhisk and IBM cloud functions
OpenWhisk and IBM cloud functions
 
The State of containerd
The State of containerdThe State of containerd
The State of containerd
 
LinuxKit and OpenOverlay
LinuxKit and OpenOverlayLinuxKit and OpenOverlay
LinuxKit and OpenOverlay
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Kürzlich hochgeladen (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 

Using linuxKit to build custom rancherOS systems

  • 1. RancherOS & Linux Kit Sven Dowideit Principal Software Engineer RancherOS 19 October 2017
  • 2. Is a micro-Linux distro • Linux Kernel, • A custom init written in go, • Uses Cloud-config to customise instances • Has a System-Docker and a User-Docker RancherOS
  • 4. #cloud-init rancher: services: rancher-agent-starter: image: rancher/agent:v1.2.5 command: http://10.10.10.168:8080/v1/scripts/22A906891A04AA99E831:1483142400000:U7MMVCDKpoYa3ngeh fX6BPBt92k privileged: true environment: - CATTLE_HOST_LABELS='magic=node' labels: io.rancher.os.scope: user io.rancher.os.after: docker restart: false volumes: - /var/run/docker.sock:/var/run/docker.sock - /var/lib/rancher:/var/lib/rancher ... Cloud-config continued
  • 5. One cut down System-Docker (v1.10-ish) And the pluggable User-Docker • v1.12.16 and up • Can be selected using the cloud-config or on the commandline. Tale of two Docker daemons
  • 6. First up, System-Docker - it’s from Q1 2016. And worse, we start it 3 times to bootstrap the OS. Each time we start a Docker daemon, we docker load < stage/Images.tar How RancherOS starts
  • 7. Use the moby tool to compose the final runnable image or ISO RancherOS has been built by composing Container Images into an Initrd since 2014 So there’s some legacy build tooling - which LinuxKit also provides. U So… what can we modernise
  • 8. Our 90M OS has turned into a 245M initrd. [ 3.715450] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100 [ 3.715450] [ 3.717145] CPU: 0 PID: 1 Comm: init Not tainted 4.9.26-rancher #1 [ 3.718061] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.10.1-1ubuntu1 04/01/2014 [ 3.719478] ffff9fd6c031fe20 ffffffffb632793c ffff9060ed820000 ffffffffb6a8d098 [ 3.720933] ffff9fd6c031fea0 ffffffffb614624d ffff9fd600000010 ffff9fd6c031feb0 [ 3.722387] ffff9fd6c031fe48 ffffffffb6c5eb28 0000000000000100 ffff9060ed830010 [ 3.723840] Call Trace: [ 3.724382] [<ffffffffb632793c>] dump_stack+0x61/0x7d [ 3.725189] [<ffffffffb614624d>] panic+0xd8/0x221 [ 3.725943] [<ffffffffb606c67a>] do_exit+0x4d4/0x92c [ 3.726717] [<ffffffffb608b8f2>] ? wake_up_state+0x10/0x12 [ 3.727539] [<ffffffffb6074485>] ? signal_wake_up_state+0x2a/0x3b [ 3.728418] [<ffffffffb606cb49>] do_group_exit+0x41/0xa2 Step 1: So we’re huge, and….
  • 9. Let’s replace System-Docker with runC and Containerd, copying the init code from LinuxKit Next up, rip out the Eye teeth
  • 10. 519M inittrd 15-20 seconds just to load initrd boot2docker in 30 seconds Step 2: even huger-er
  • 11. LinuxKit’s service cfg doesn’t share images, it lays one down per entry Also means we need to add overlayfs Share images between services
  • 12. 383M initrd 14s to starting initrd boot2docker in 25 seconds Step 3: baby steps
  • 13. There’s a bunch of files that were needed by System Docker that we can remove. Remove cruft
  • 14. 190M initrd 5s to get to starting init boot2docker in 12seconds Step 4: ok, this is fine.
  • 15. use the os-config.tmpl to generate the runtime spec no actual change in size or speed Generate containerd spec
  • 16. client, err := containerd.New(config.DefaultContainerdSocket) ctx := namespaces.WithNamespace(context.Background(), "default") ctr, err := client.NewContainer(ctx, serviceName, containerd.WithNewSpec( withService(cfg, serviceSet, service), removeRunTmpfsMount(), withDevicesFromSpec(spec), withOverlay(rootfs, rwDir, workDir), dumpSpec(serviceName+".new"), ), ) task, err := ctr.NewTask(ctx, io, WithNoPivotRoot()) err := task.Start(ctx) Code
  • 17. rancher: services: nginx: image: nginx command: nginx -g 'daemon off;' labels: io.rancher.os.scope: system io.rancher.os.after: docker restart: always ports: - "80:80" volumes_from: volumes: - /usr/bin/ros:/usr/bin/ros And finally, customise
  • 18. about 11 seconds to serve the first HTTP request adding the default nginx image adds ~30M to the initrd $ docker images nginx REPOSITORY TAG IMAGE ID CREATED SIZE nginx latest 1e5ab59102ce 7 days ago 108MB Step N: wash cycle
  • 19. dhcp is taking 3s - hard-code the IP start nginx after network use the os-console image for all os-base services smaller, simpler LinuxKit kernel image Lets break all the things
  • 20. boot2your-service in 7 seconds This is still RancherOS it still uses cloud-init to load host specific settings. (Though it can go really badly due to conference wifi :) ) Step N+1: boot2your-service