All Projects â†’ containers â†’ Crun

containers / Crun

Licence: other
A fast and lightweight fully featured OCI runtime and C library for running containers

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Crun

Wasm3
🚀 The fastest WebAssembly interpreter, and the most universal runtime
Stars: ✭ 4,375 (+341.92%)
Mutual labels:  iot, containers
Cc Oci Runtime
OCI (Open Containers Initiative) compatible runtime for Intel® Architecture
Stars: ✭ 418 (-57.78%)
Mutual labels:  containers, oci
Umoci
umoci modifies Open Container images
Stars: ✭ 349 (-64.75%)
Mutual labels:  containers, oci
inclavare-containers
A novel container runtime, aka confidential container, for cloud-native confidential computing and enclave runtime ecosystem.
Stars: ✭ 510 (-48.48%)
Mutual labels:  runtime, oci
Tectonic Installer
Install a Kubernetes cluster the CoreOS Tectonic Way: HA, self-hosted, RBAC, etcd Operator, and more
Stars: ✭ 599 (-39.49%)
Mutual labels:  containers, oci
Eliot
Open source system for managing containerized applications in IoT device
Stars: ✭ 258 (-73.94%)
Mutual labels:  iot, containers
Grype
A vulnerability scanner for container images and filesystems
Stars: ✭ 362 (-63.43%)
Mutual labels:  containers, oci
Distribution Spec
OCI Distribution Specification
Stars: ✭ 250 (-74.75%)
Mutual labels:  containers, oci
Sysbox
Sysbox repository
Stars: ✭ 596 (-39.8%)
Mutual labels:  runtime, containers
Runtime
OCI (Open Containers Initiative) compatible runtime using Virtual Machines
Stars: ✭ 588 (-40.61%)
Mutual labels:  containers, oci
Netdata
Real-time performance monitoring, done right! https://www.netdata.cloud
Stars: ✭ 57,056 (+5663.23%)
Mutual labels:  iot, containers
Distribution
The toolkit to pack, ship, store, and deliver container content
Stars: ✭ 6,445 (+551.01%)
Mutual labels:  containers, oci
Wasm Micro Runtime
WebAssembly Micro Runtime (WAMR)
Stars: ✭ 2,440 (+146.46%)
Mutual labels:  iot, runtime
Dockerfile
Dockerfile best-practices for writing production-worthy Docker images.
Stars: ✭ 3,506 (+254.14%)
Mutual labels:  containers, oci
Docker Blinkt Workshop
Get into physical computing with Docker and Raspberry Pi
Stars: ✭ 151 (-84.75%)
Mutual labels:  iot, containers
Buildkit
concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit
Stars: ✭ 4,537 (+358.28%)
Mutual labels:  containers, oci
Containership
A simple container management platform
Stars: ✭ 241 (-75.66%)
Mutual labels:  containers, oci
Runj
runj is an experimental, proof-of-concept OCI-compatible runtime for FreeBSD jails.
Stars: ✭ 211 (-78.69%)
Mutual labels:  containers, oci
Pouch
An Efficient Enterprise-class Container Engine
Stars: ✭ 4,483 (+352.83%)
Mutual labels:  containers, oci
Runq
run regular Docker images in KVM/Qemu
Stars: ✭ 616 (-37.78%)
Mutual labels:  runtime, oci

crun

Build Status Coverity Status Total alerts Language grade: C/C++

A fast and low-memory footprint OCI Container Runtime fully written in C.

crun conforms to the OCI Container Runtime specifications (https://github.com/opencontainers/runtime-spec).

Documentation

The user documentation is available here.

Why another implementation?

While most of the tools used in the Linux containers ecosystem are written in Go, I believe C is a better fit for a lower level tool like a container runtime. runc, the most used implementation of the OCI runtime specs written in Go, re-execs itself and use a module written in C for setting up the environment before the container process starts.

crun aims to be also usable as a library that can be easily included in programs without requiring an external process for managing OCI containers.

Performance

crun is faster than runc and has a much lower memory footprint.

This is the elapsed time on my machine for running sequentially 100 containers, the containers run /bin/true:

crun runc %
100 /bin/true 0:01.69 0:3.34 -49.4%

crun requires fewer resources, so it is also possible to set stricter limits on the memory and number of PIDs allowed in the container:

# podman --runtime /usr/bin/runc run --rm --pids-limit 1 fedora echo it works
Error: container_linux.go:346: starting container process caused "process_linux.go:319: getting the final child's pid from pipe caused \"EOF\"": OCI runtime error

# podman --runtime /usr/bin/crun run --rm --pids-limit 1 fedora echo it works
it works

# podman --runtime /usr/bin/runc run --rm --memory 4M fedora echo it works
Error: container_linux.go:346: starting container process caused "process_linux.go:327: getting pipe fds for pid 13859 caused \"readlink /proc/13859/fd/0: no such file or directory\"": OCI runtime command not found error

# podman --runtime /usr/bin/crun run --rm --memory 4M fedora echo it works
it works

crun could go much lower than that, and require < 1M. The used 4MB is a hard limit set directly in Podman before calling the OCI runtime.

Dependencies

These dependencies are required for the build:

Fedora

$ sudo dnf install -y make python git gcc automake autoconf libcap-devel \
    systemd-devel yajl-devel libseccomp-devel \
    go-md2man glibc-static python3-libmount libtool

RHEL/CentOS 8

$ sudo yum --enablerepo='*' --disablerepo='media-*' install -y make automake \
    autoconf gettext \
    libtool gcc libcap-devel systemd-devel yajl-devel \
    libseccomp-devel python36 libtool git

go-md2man is not available on RHEL/CentOS 8, so if you'd like to build the man page, you also need to manually install go-md2man. It can be installed with:

$ sudo yum --enablerepo='*' install -y golang
$ export GOPATH=$HOME/go
$ go get github.com/cpuguy83/go-md2man
$ export PATH=$PATH:$GOPATH/bin

Ubuntu

$ sudo apt-get install -y make git gcc build-essential pkgconf libtool \
   libsystemd-dev libcap-dev libseccomp-dev libyajl-dev \
   go-md2man libtool autoconf python3 automake

Alpine

# apk add gcc automake autoconf libtool gettext pkgconf git make musl-dev \
    python3 libcap-dev libseccomp-dev yajl-dev argp-standalone go-md2man

Tumbleweed

# zypper install make automake autoconf gettext libtool gcc libcap-devel \
systemd-devel libyajl-devel libseccomp-devel python3 libtool go-md2man \
glibc-static;

Note that Tumbleweed requires you to specify libseccomp's header file location as a compiler flag.

# ./autogen.sh
# ./configure CFLAGS='-I/usr/include/libseccomp'
# make

Build

Unless you are also building the Python bindings, Python is needed only by libocispec to generate the C parser at build time, it won't be used afterwards.

Once all the dependencies are installed:

$ ./autogen.sh
$ ./configure
$ make

To install into default PREFIX (/usr/local):

$ sudo make install

Shared Libraries

The previous build instructions do not enable shared libraries, therefore you will be unable to use libcrun. If you wish to build the shared libraries you can change the previous ./configure.sh statement to ./configure --enable-shared.

Static build

It is possible to build a statically linked binary of crun by using the officially provided nix package and the derivation of it within this repository. The builds are completely reproducible and will create a x86_64/amd64 stripped ELF binary for glibc.

Nix

To build the binaries by locally installing the nix package manager:

$ nix build -f nix/

Ansible

An Ansible Role is also available to automate the installation of the above statically linked binary on its supported OS:

$ sudo su -
# mkdir -p ~/.ansible/roles
# cd ~/.ansible/roles
# git clone https://github.com/alvistack/ansible-role-crun.git crun
# cd ~/.ansible/roles/crun
# pip3 install --upgrade --ignore-installed --requirement requirements.txt
# molecule converge
# molecule verify
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].