Skip to content
/ gocker Public

A Docker implementation written in Golang designed for educational purposes.

Notifications You must be signed in to change notification settings

Ninroot/gocker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gocker

gocker logo

A Docker implementation written in Golang designed for educational purposes. Gocker enables you to create and manage container, pull images, and more. We do not recommend using it in production environments, and suggest running it inside a virtual machine instead.

Prerequisites

Gocker runs only on Linux-based system with version 3.10 or higher of the Linux kernel.

Required packages:

  • libcgroup-tools

Required configuration:

  • A btrfs filesystem mounted under /var/gocker (configurable)
  • A cgroup filesystem mounted under /sys/fs/cgroup/ (configurable) if not already the case

Install

git clone https://github.com/Ninroot/gocker
cd gocker/
make
cd build/
./gocker --help

Example of use

When using Gocker, you need to be specific when pulling or running an image, as it does not have the same magic as Docker does. For example, use pull amd64/alpine instead of just pull alpine.

# gocker requires root privileges
sudo su

# image for ARM-based system (like mac running on Apple silicon)
./gocker pull arm64v8/alpine

./gocker run arm64v8/alpine:latest /bin/sh

./gocker image rm arm64v8/alpine

Isolation

  • file system: via chroot, gives the illusion the container can navigate inside a different distro.
  • PID: via namespace, isolates the processes running inside a container with processes of the host / other containers.
  • Mount: via namespace, isolates the mounts to the container. This prevents the mounts from being visible from the host.
  • UTS: via namespace, allows to set a new hostname inside the container without affecting the hostname of the host.

Learn

Great souces to learn Docker:

About

A Docker implementation written in Golang designed for educational purposes.

Topics

Resources

Stars

Watchers

Forks