This document discusses modernizing RancherOS, a micro Linux distribution. It describes replacing System Docker with runC and Containerd to reduce size and improve performance. Through iterative changes like removing unused files, generating container specs, and customizing services, the initrd size was reduced from 245MB to 190MB and boot time from 30 seconds to 12 seconds. The final version can boot and serve HTTP requests within 7 seconds while maintaining compatibility with RancherOS.
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
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
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