Home-Software Development-Exploring Container Deployment: nerdctl to the Rescue!
article nerdctl

Exploring Container Deployment: nerdctl to the Rescue!

Exploring Container Deployment: nerdctl to the Rescue!

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”.


What is 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:

  • Functionality akin to docker
  • Docker Compose support
  • Rootless mode support (minus the slirp overhead)
  • Lazy-pulling of images
  • Support for encrypted images
  • P2P image distribution
  • Container image signing and verification capabilities


Prerequisites for Installation

Before diving into the installation, ensure you have:

  • A running Ubuntu Server 22.04 instance.
  • A user equipped with sudo privileges.

Once set, it’s time to dive in!

Step-by-step Installation Guide

1. Installing containerd

  • Firstly, visit the Containerd Download Page to secure the latest version.
  • Log into Ubuntu and access the terminal. Execute the command to initiate the download:
wget https://github.com/containerd/containerd/releases/download/v1.6.8/containerd-1.6.8-linux-amd64.tar.gz
  • Unpack containerd into the designated directory:
sudo tar Cxzvf /usr/local containerd-1.6.8-linux-amd64.tar.gz

2. Downloading Necessary Tools

  • Download the runc command line tool:
wget https://github.com/opencontainers/runc/releases/download/v1.1.3/runc.amd64
  • Install runc:
sudo install -m 755 runc.amd64 /usr/local/sbin/runc

  • Get the Container Network Interface (CNI):
wget https://github.com/containernetworking/plugins/releases/download/v1.1.1/cni-plugins-linux-amd64-v1.1.1.tgz


  • Set up a directory for CNI and unpack:
sudo mkdir -p /opt/cni/bin
sudo tar Cxzvf /opt/cni/bin cni-plugins-linux-amd64-v1.1.1.tgz




3. Configuring containerd

  • Generate the configuration:
containerd config default | sudo tee /etc/containerd/config.toml




  • Adjust SystemdCgroup settings:
sudo sed -i 's/SystemdCgroup \= false/SystemdCgroup \= true/g' /etc/containerd/config.toml

  • Manage the containerd service:
sudo curl -L https://raw.githubusercontent.com/containerd/containerd/main/containerd.service -o /etc/systemd/system/containerd.service

  • Reload and start the service:
sudo systemctl daemon-reload
sudo systemctl enable --now containerd


4. Installing nerdctl

  • Add necessary dependencies:
sudo apt-get install uidmap rootlesskit -y



  • Download and unpack nerdctl:
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




Deploying a Container Using nerdctl

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






Conclusion

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.

logo softsculptor bw

Experts in development, customization, release and production support of mobile and desktop applications and games. Offering a well-balanced blend of technology skills, domain knowledge, hands-on experience, effective methodology, and passion for IT.

Search

© All rights reserved 2012-2024.