Ever wondered about the plethora of ways to deploy a container? Well, the options might be more than you can count. And for those who love having a myriad of options, it’s nothing short of a bonanza. This article sheds light on an additional method to enhance your deployment choices – the intriguingly named “nerdctl”.
Simply put, the nerdctl command sits comfortably on top of containerd. It facilitates the deployment of containers using the containerd runtime. On its own, containerd might seem somewhat ineffectual. In reality, containerd is a runtime that functions in sync with other tools for deployment. And that’s where nerdctl steps in.
Why nerdctl?
Beyond its catchy name, nerdctl boasts a plethora of features, including:
Before diving into the installation, ensure you have:
Once set, it’s time to dive in!
1. Installing containerd
wget https://github.com/containerd/containerd/releases/download/v1.6.8/containerd-1.6.8-linux-amd64.tar.gz
sudo tar Cxzvf /usr/local containerd-1.6.8-linux-amd64.tar.gz
2. Downloading Necessary Tools
wget https://github.com/opencontainers/runc/releases/download/v1.1.3/runc.amd64
sudo install -m 755 runc.amd64 /usr/local/sbin/runc
wget https://github.com/containernetworking/plugins/releases/download/v1.1.1/cni-plugins-linux-amd64-v1.1.1.tgz
sudo mkdir -p /opt/cni/bin
sudo tar Cxzvf /opt/cni/bin cni-plugins-linux-amd64-v1.1.1.tgz
3. Configuring containerd
containerd config default | sudo tee /etc/containerd/config.toml
sudo sed -i 's/SystemdCgroup \= false/SystemdCgroup \= true/g' /etc/containerd/config.toml
sudo curl -L https://raw.githubusercontent.com/containerd/containerd/main/containerd.service -o /etc/systemd/system/containerd.service
sudo systemctl daemon-reload
sudo systemctl enable --now containerd
4. Installing nerdctl
sudo apt-get install uidmap rootlesskit -y
wget https://github.com/containerd/nerdctl/releases/download/v0.22.2/nerdctl-0.22.2-linux-amd64.tar.gz
sudo tar Cxzvf /usr/local/bin nerdctl-0.22.2-linux-amd64.tar.gz
docker run --name docker-nginx -p 8080:80 -d nginx:alpine
Deploying containers with nerdctl mirrors Docker. For instance, to deploy an NGINX container with Docker:
With nerdctl, it’s:
nerdctl run --name nerdctl-nginx -p 8080:80 -d nginx:alpine
Container deployment with nerdctl not only gets nerdier but also more efficient. If containerd is your chosen engine and Docker-like deployment is what you seek, nerdctl is your perfect ally!
Note: This article does not contain the imagery-based data as it wasn’t provided in the prompt. Ensure to incorporate the necessary imagery to augment the user’s comprehension.