Runc: Difference between revisions

From Alpine Linux
(based on posting in https://irclogs.alpinelinux.org/%23alpine-linux-2025-07.log by user Donno at https://tpaste.us/gbvy)
 
(tested and updated the instructions)
Line 1: Line 1:
[https://github.com/opencontainers/runc Runc] is a CLI tool for spawning and running containers on Linux according to the OCI specification. This page provides instructions to setup containers using runc.
[https://github.com/opencontainers/runc Runc] is a CLI tool for spawning and running containers on Linux according to the OCI specification. This page provides instructions to setup containers using runc.
{{Draft}}
 
== Prerequisites ==
 
* Enable [[OpenRC#cgroups|cgroups]]
 
== Set up a minimal container ==
== Set up a minimal container ==
Here are the steps to create a minimal container using runc and Alpine Linux.


{{Cmd|# apk add runc}}
{{Cmd|# apk add runc}}
{{Cmd|# mkdir /opt/busybox-container}}
{{Cmd|# mkdir /opt/busybox-container}}
{{Cmd|# apk --arch x86_64 -X https://dl-cdn.alpinelinux.org/alpine/edge/main/ --root /opt/busybox-container/rootfs --initdb --no-cache --allow-untrusted add busybox}}
{{Cmd|# apk --arch x86_64 -X <nowiki>https://dl-cdn.alpinelinux.org/alpine/edge/main/</nowiki> --root /opt/busybox-container/rootfs --initdb --no-cache --allow-untrusted add busybox}}
{{Cmd|# cd /opt/busybox-container && runc spec}}
{{Cmd|# cd /opt/busybox-container && runc spec}}
{{Cmd|# cd /opt/busybox-container}}
{{Cmd|# runc run busybox-1}}
{{Cmd|# runc run busybox-1}}

Revision as of 15:45, 4 July 2025

Runc is a CLI tool for spawning and running containers on Linux according to the OCI specification. This page provides instructions to setup containers using runc.

Prerequisites

Set up a minimal container

Here are the steps to create a minimal container using runc and Alpine Linux.

# apk add runc

# mkdir /opt/busybox-container

# apk --arch x86_64 -X https://dl-cdn.alpinelinux.org/alpine/edge/main/ --root /opt/busybox-container/rootfs --initdb --no-cache --allow-untrusted add busybox

# cd /opt/busybox-container && runc spec

# runc run busybox-1