1. Download binary package of nerdctl-full

Attention:
Downloading from https://github.com/containerd/nerdctl/releases may be very slow in china, and even fail due to that it takes too long time, exceeding the connection timeout of the website, and then retry connection,and "Authorization Required" (namely user and password of objects.githubusercontent), if not input, connection fails.

“发现当GitHub下载时,链接使用HTTP 302从提供的资源重定向至objects.githubusercontent.com,使用特殊的time-limited签名URL。下载失败时,链接不再有效。当程序重试连接时,它应该使用原始URL重试,因为HTTP 302是一个临时重定向,因此user-agent(你的浏览器或下载工具)应该访问原始URL,因为重定向可能会更改。“[1]

[SOLUTION]

  1. On webpage https://github.com/containerd/nerdctl/releases, click "Assets", put cursor at "nerdctl-full-2.0.0-beta.0-linux-amd64.tar.gz" (this is the package to download in this example, replace with the actual package in your case), right click mouse --> choose "copy link address" . The copied link address is: https://github.com/containerd/nerdctl/releases/download/v2.0.0-beta.0/nerdctl-full-2.0.0-beta.0-linux-amd64.tar.gz .

$ wget https://download.fastgit.org/containerd/nerdctl/releases/download/v2.0.0-beta.0/nerdctl-full-2.0.0-beta.0-linux-amd64.tar.gz

-->[2]
2024-02-01 16:31:29 https://download.fastgit.org/containerd/nerdctl/releases/download/v2.0.0-beta.0/nerdctl-full-2.0.0-beta.0-linux-amd64.tar.gz
Resolving download.fastgit.org (download.fastgit.org)... 216.73.158.236, 2602:fed2:7318:72::a
Connecting to download.fastgit.org (download.fastgit.org)|216.73.158.236|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://download.fgit.cf/containerd/nerdctl/releases/download/v2.0.0-beta.0/nerdctl-full-2.0.0-beta.0-linux-amd64.tar.gz [following]
--2024-02-01 16:31:34-- https://download.fgit.cf/containerd/nerdctl/releases/download/v2.0.0-beta.0/nerdctl-full-2.0.0-beta.0-linux-amd64.tar.gz
Resolving download.fgit.cf (download.fgit.cf)... 216.73.158.236, 2602:fed2:7318:72::a
Connecting to download.fgit.cf (download.fgit.cf)|216.73.158.236|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 238907758 (228M) [application/octet-stream]
Saving to: ‘nerdctl-full-2.0.0-beta.0-linux-amd64.tar.gz’

Note:
Binaries are available here: https://github.com/containerd/nerdctl/releases
In addition to containerd, the following components should be installed:

CNI plugins: for using nerdctl run.
v1.1.0 or later is highly recommended. Older versions require extra CNI isolation plugin for isolating bridge networks (nerdctl network create).
BuildKit (OPTIONAL): for using nerdctl build. BuildKit daemon (buildkitd) needs to be running. See also the document about setting up BuildKit.
v0.11.0 or later is highly recommended. Some features, such as pruning caches with nerdctl system prune, do not work with older versions.
RootlessKit and slirp4netns (OPTIONAL): for Rootless mode
RootlessKit needs to be v0.10.0 or later. v2.0.0 or later is recommended.
slirp4netns needs to be v0.4.0 or later. v1.1.7 or later is recommended.
These dependencies are included in nerdctl-full---.tar.gz, but not included in nerdctl---.tar.gz. [3]

2. unzip the package to /usr/local

tar Cxzvvf /usr/local nerdctl-full-${version}-linux-amd64.tar.gz

3. set Rootless for using nerdctl [4]

$ containerd-rootless-setuptool.sh install

4. Error & Solution

[ERROR: failed to setup UID/GID map]
./containerd-rootless-setuptool.sh install
[INFO] Checking RootlessKit functionality
[rootlesskit:parent] error: failed to setup UID/GID map: newuidmap 328299 [0 1000 1 1 100000 65536] failed: : exec: "newuidmap": executable file not found in $PATH

[SOLUTION]
sudo apt install uidmap

Referneces:


  1. http://www.taodudu.cc/news/show-5545913.html?action=onClick ↩︎

  2. https://www.cnblogs.com/dereklovecc/p/16640096.html ↩︎

  3. https://github.com/containerd/nerdctl ↩︎

  4. https://github.com/containerd/nerdctl/releases ↩︎