containers-from-scratch-cli

command module
v0.0.0-...-8518c03 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2023 License: MIT Imports: 17 Imported by: 0

README

containers-from-scratch-cli

Who is this repo for? If you've written a Dockerfile, built an image, run a container and now want to know what's going on under the hood, this repo is for you!

In this repo, is a Go CLI that mimic the Docker run and build commands. After building the cli and executing its commands, I encourage you to poke around the code base or watch the livestreams to indulge your curiosity about how containers work. :)

Step 1: Build the containerCLI

go build . -o containercli

Step 2: Run a container with

A few notes:

  • Container isolation is achieved by the use of a Linux Kernel feature called Namespaces.
  • Resource constraint is achieved by the use of cgroups.

What's docker build doing?

Download Alpine for chroot:

mkdir alpine
cd alpine
curl -o alpine.tar.gz http://dl-cdn.alpinelinux.org/alpine/v3.10/releases/x86_64/alpine-minirootfs-3.10.0-x86_64.tar.gz
tar xvf alpine.tar.gz
rm alpine.tar.gz
touch ALPINE_CONTAINER_ROOT

Download Ubuntu for chroot:

sudo apt install debootstrap
sudo debootstrap jammy ./ubuntu-rootfs http://archive.ubuntu.com/ubuntu/

stress mem and cpu

./stress --vm 1 --vm-bytes 100M

Documentation

Overview

Download distro Create temp dir Extract rootfs Run COPY instructions Create container archive (Let run func read RUN instruction)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL