Minict is a minimal container runtime written in Go.

Related tags

Utilities containers
Overview

Minict

Minict is a minimal container runtime written in Go. It was made mainly for learning purposes and is intended to be as simple as possible.

It's main intention is to be easily understandable to anyone who wishes to read it's code and see what goes into running containers in famous runtimes such as Containerd and full container-running platforms like Docker.

Minict runs OCI standard images and supports pulling images from existing registries.

Prerequisites

  • The gpgme-devel package must be installed on your system.
    • Run sudo dnf install gpgme-devel on RHEL-based distros (RHEL, CentOS, Fedora, etc.)
    • Run sudo apt install libgpgme-dev on Debian-based distros (Debian, Ubuntu, etc.)
  • Have golang and git installed.

Usage

  • Either download the current binary from the releases page, or compile with the instuctions below.
  • Once you have the executable, start using it with the help of the Getting started section below or by running the executable with the --help or -h flag.

Building & Running

  • Clone this repository into your $HOME/go/src directory and run cd $HOME/go/src/minict
  • Run the go get command.
  • Run the go build command.
  • You should now have a minict executable in your directory. Run chmod a+x minict and it can now be used.
  • To use it from anywhere easily, move the minict executable to a directory that is in yout PATH variable. One such directory should be /usr/bin.

Getting Started

  • Pulling an image:
sudo minict pull --image ubuntu:20.04
  • Running a new container:
sudo minict run --image ubuntu:20.04 --name ubuntu-ctr
  • Starting an existing container:
sudo minict start --name ubuntu-ctr
  • Listing all images:
>>> sudo minict list-images

[
  "alpine:latest",
  "ubuntu:20.04"
]
  • Listing all containers:
>>> sudo minict list-containers

[
  "container1",
  "container2",
  "alpine-ctr",
  "ubuntu-ctr"
]
  • Removing an existing container:
sudo minict rm --name ubuntu-ctr

Running information

  • Container management is entirely based on the filesystem, and no DBs or separate inventories are used.
  • By default, minict will use the /var/lib/minict directory for everything that it stores on disk. This can be changed by setting the MINICT_DIR environment variable to a new location. For example:
sudo MINICT_DIR=/new/location minict pull --image alpine:3.11

Important Notes & Disclaimers:

  • Since this is intended to be small and minimal project, only basic OCI settings are supported. Currently, minict supports the following features:
    • Cmd / Entrypoint
    • Env variables
    • Mounts - Partial support, some mounts won't work and you might see mounting error when starting containers, but the basic mounts that are required for most containers are supported.
    • Hostname
  • All other OCI settings are ignored.
  • Containers do not start with a networking namespace at the moment. While it is possible to add and there are existing Go libraries and tools to help make that easier, it will cause running containers to not be reachable without implementing more features like port mapping between the host and the containers and more, which is beyond the scope I set for this project at the moment.
  • Minict is in NO way meant to be used in production. This is nothing more than a personal project and I take no responsibility for anything that using it might cause.
  • While I tested this on my personal system and tried my best to cleanup everything once a container is removed, note that it does setup namespaces and mounts on the system, so for completely risk-free usage I'd suggest using it on a VM.

Sources & Other interesting projects

  • Minict used the umoci tool to unpack images, and uses code that was inspired by skopeo to pull images. Check out those projects if you're interested in how its done. Plus they are both great tools in general.
  • bocker is a projects that attmepts to implement Docker in ~100 lines of bash. Not directly related to this project but a cool one nonetheless that you might find interesting if you are interested in this one.
You might also like...
Galvanity is Algorand vanity address generator written in Go

Galvanity Galvanity is Algorand vanity address generator written in Go Usage galvanity [search-type] pattern search-type is matching function to sea

Geographic coordinates and distances library written in Go.

Geographic coordinates and distances library written in Go.

A concurrent Download Manager written in Go

golang-download-manager A concurrent Download Manager written in Go Changes In main.go file paste the file url in fileUrl variable paste the path for

CookieStealer written in Go

CookieStealer written in Go

A fully Go userland with Linux bootloaders! u-root can create a one-binary root file system (initramfs) containing a busybox-like set of tools written in Go.

u-root Description u-root embodies four different projects. Go versions of many standard Linux tools, such as ls, cp, or shutdown. See cmds/core for m

 Julia Set Generator Written In Golang
Julia Set Generator Written In Golang

Julia Set Generator Written In Golang This is a simple (naive) Julia Set generator written in Golang. The project utilizes concurrent workers to speed

Sentiment Analysis Pipeline + API written in Golang (currently processing Twitter tweets).

Go Sentiment Analysis Components Config: config module based in JSON (enter twitter credentials for use) Controllers: handle the API db call/logic for

Simple base64 coder/decoder written in Golang

base64-coder simple base64 coder/decoder written in Golang 🖱️ Releases usage example Encode: ./b64 encode from.txt to.dat Decode: ./b64 encode to.dat

Sentiment Analysis Pipeline + API written in Golang (currently processing Twitter tweets).

Go Sentiment Analysis Components Config: config module based in JSON (enter twitter credentials for use) Controllers: handle the API db call/logic for

Comments
  • static binary?

    static binary?

    Hi,

    is it possible to compile it as static binary?

    /usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
    /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lassuan
    /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lgpg-error
    

    Searched about that error and found a glibc dependency, right? I try to compile with alpine linux / musl and would prefer a small binary build.

    opened by pwFoo 2
Releases(1.0.0)
Owner
null
Golang library to act on structure fields at runtime. Similar to Python getattr(), setattr(), hasattr() APIs.

go-attr Golang library to act on structure fields at runtime. Similar to Python getattr(), setattr(), hasattr() APIs. This package provides user frien

Shyamsunder Rathi 27 Jul 5, 2022
A Runtime Struct Builder for Go

A Runtime Struct Builder for Go

null 31 Jul 8, 2022
reflect api without runtime reflect.Value cost

reflect2 reflect api that avoids runtime reflect.Value cost reflect get/set interface{}, with type checking reflect get/set unsafe.Pointer, without ty

Modern Go Programming 633 Nov 23, 2022
Minimal UART client in Golang that dumps LPC1343 chips that are locked at CRP1.

Howdy y'all, This is a quick and dirty client for the UART bootloader of the LPC1343, and probably other bootloaders in that chip family. This client

Travis Goodspeed 14 Oct 16, 2022
Automatically set GOMAXPROCS to match Linux container CPU quota.

automaxprocs Automatically set GOMAXPROCS to match Linux container CPU quota. Installation go get -u go.uber.org/automaxprocs Quick Start import _ "go

Uber Go 2.3k Nov 27, 2022
bebop is a bebop parser written in Go, for generating Go code.

bebop is a bebop parser written in Go, for generating Go code. bebop can read .bop files and output .go files representing them: package main i

Patrick Stephen 47 Nov 6, 2022
A simple thread-safe, fixed size LRU written in Go. Based on dominictarr's Hashlru Algorithm. 🔃

go-hashlru A simple thread-safe, fixed size LRU written in Go. Based on dominictarr's Hashlru Algorithm. ?? Uses map[interface{}]interface{} to allow

Saurabh Pujari 72 Sep 18, 2022
Elf binary infector written in Golang

Elf binary infector written in Golang. It can be used for infecting executables of type ET_DYN and ET_EXEC with a payload of your creation. Utilizing the classic elf text segment padding algorithm by Silvio Cesar, your payload (parasite) will run before native functionality of the binary effectively backooring the binary.

null 149 Nov 9, 2022
Ento is an Entity Component System written in Go.

Ento is an Entity Component System written in Go.

Wojciech Franczyk 10 Sep 13, 2022
Nintendo 64 ROM utility written in Go.

Nintendo 64 ROM utility written in Go. Commands ls - List information about all ROMs in a directory info - Show information about a single ROM convert

Mike Roach 22 Oct 27, 2022