Skip to content

Commit 9b02953

Browse files
committed
New Nerdctl install guide
1 parent 5039f2a commit 9b02953

File tree

1 file changed

+181
-0
lines changed

1 file changed

+181
-0
lines changed

content/install-guides/nerdctl.md

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
---
2+
title: Nerdctl
3+
author: Jason Andrews
4+
5+
draft: true
6+
7+
minutes_to_complete: 10
8+
9+
official_docs: https://github.com/containerd/nerdctl
10+
11+
additional_search_terms:
12+
- container
13+
- containerd
14+
- docker
15+
- Linux
16+
17+
test_images:
18+
- ubuntu:latest
19+
test_maintenance: false
20+
21+
tool_install: true
22+
layout: installtoolsall
23+
multi_install: false
24+
multitool_install_part: false
25+
weight: 1
26+
---
27+
28+
Nerdctl is an open-source command-line interface (CLI) designed to be compatible with the popular Docker CLI, but specifically for interacting with [containerd](https://containerd.io/). It provides a familiar user experience for developers operators who are familiar with Docker, while leveraging the capabilities of containerd as the underlying container runtime.
29+
30+
Using containerd and nerdctl provides similar functionality to Docker but with a smaller memory and CPU footprint, making it ideal for IoT or edge solutions, especially on Arm devices which balance energy efficiency and performance. Nerdctl also supports running containers in a rootless mode, enhancing security by not requiring elevated privileges.
31+
32+
This guide focuses on installing containerd and Nerdctl on Arm Linux.
33+
34+
## Before you begin
35+
36+
This guide assumes you are using Ubuntu 22.04 or later on an Arm-based system (like a Raspberry Pi or an Arm instance in the cloud).
37+
38+
Confirm you are using an Arm machine by running:
39+
40+
```bash
41+
uname -m
42+
```
43+
44+
The output should be:
45+
46+
```output
47+
aarch64
48+
```
49+
50+
Ensure `wget` and `tar` are installed:
51+
52+
```bash
53+
sudo apt-get update
54+
sudo apt-get install -y wget tar
55+
```
56+
57+
## Install containerd
58+
59+
Install the containerd runtime:
60+
61+
```bash
62+
sudo apt-get update
63+
sudo apt-get install -y containerd
64+
```
65+
66+
Start and enable the containerd service:
67+
68+
```bash
69+
sudo systemctl start containerd
70+
sudo systemctl enable containerd
71+
```
72+
73+
## Install nerdctl and CNI plugins
74+
75+
Install nerdctl and the necessary CNI (Container Network Interface) plugins. Replace version numbers if needed.
76+
77+
```bash
78+
NERDCTL_VERSION=$(curl -s https://api.github.com/repos/containerd/nerdctl/releases/latest | grep tag_name | cut -d '"' -f 4 | sed 's/v//')
79+
wget https://github.com/containerd/nerdctl/releases/download/v${NERDCTL_VERSION}/nerdctl-${NERDCTL_VERSION}-linux-arm64.tar.gz
80+
sudo tar -xzvf nerdctl-${NERDCTL_VERSION}-linux-arm64.tar.gz -C /usr/local/bin
81+
```
82+
83+
Install the CNI plugins:
84+
85+
```bash
86+
CNI_VERSION=$(curl -s https://api.github.com/repos/containernetworking/plugins/releases/latest | grep tag_name | cut -d '"' -f 4 | sed 's/v//')
87+
wget https://github.com/containernetworking/plugins/releases/download/v${CNI_VERSION}/cni-plugins-linux-arm64-v${CNI_VERSION}.tgz
88+
sudo mkdir -p /opt/cni/bin
89+
sudo tar -xzvf cni-plugins-linux-arm64-v${CNI_VERSION}.tgz -C /opt/cni/bin
90+
```
91+
92+
Clean up the downloaded files:
93+
94+
```bash
95+
rm nerdctl-${NERDCTL_VERSION}-linux-arm64.tar.gz cni-plugins-linux-arm64-v${CNI_VERSION}.tgz
96+
```
97+
98+
99+
{{% notice Note %}}
100+
The commands above attempt to fetch the latest versions automatically. You can replace `${NERDCTL_VERSION}` and `${CNI_VERSION}` with specific versions if required.*
101+
{{% /notice %}
102+
103+
## Verify the installation
104+
105+
Test your installation by running a simple NGINX container:
106+
107+
```console
108+
sudo nerdctl run --name uname armswdev/uname
109+
```
110+
111+
Wait a few seconds for the container to run, and the Architecture is printed:
112+
113+
```output
114+
Architecture is aarch64
115+
```
116+
117+
118+
Clean up the test container:
119+
120+
```console
121+
sudo nerdctl rm uname
122+
```
123+
124+
You can also check the nerdctl version:
125+
```console
126+
sudo nerdctl version
127+
```
128+
129+
## Basic nerdctl commands
130+
131+
Here are some common commands to get you started:
132+
133+
List running containers:
134+
135+
```console
136+
sudo nerdctl ps
137+
```
138+
139+
List all containers (including stopped):
140+
141+
```console
142+
sudo nerdctl ps -a
143+
```
144+
145+
List images:
146+
147+
```console
148+
sudo nerdctl images
149+
```
150+
151+
Pull an image:
152+
153+
```console
154+
sudo nerdctl pull <image_name>:<tag>
155+
```
156+
157+
Build an image from Dockerfile in current directory:
158+
159+
```console
160+
sudo nerdctl build -t <image_name>:<tag> .
161+
```
162+
163+
Remove an image:
164+
165+
```console
166+
sudo nerdctl rmi <image_name>:<tag>
167+
```
168+
169+
Stop a container:
170+
171+
```console
172+
sudo nerdctl stop <container_name_or_id>
173+
```
174+
175+
Remove a container:
176+
177+
```console
178+
sudo nerdctl rm <container_name_or_id>
179+
```
180+
181+
You are now ready to use nerdctl and containerd.

0 commit comments

Comments
 (0)