💬

Ubuntu 22.04 LTS の containerd を OS 標準のものから containerd.io に入れ替えた

2023/01/29に公開

Docker リポジトリをセットアップする

下記の通り、既に Ubuntu 上では docker.com の APT リポジトリがセットアップ済みでした。

setup_docker_repository
- name: Install Docker public signing key
  shell: curl -sSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor --yes -o /usr/share/keyrings/docker-archive-keyring.gpg

- name: Add the Docker apt repository
  lineinfile:
    path: /etc/apt/sources.list.d/docker.list
    line: deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu jammy stable
    create: yes

Docker リポジトリから containerd.io をインストールする

既存の containerd パッケージを上書きする形になりますが特攻します。

imksoo@k8smaster:~$ sudo apt install containerd.io
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  bridge-utils dns-root-data dnsmasq-base pigz ubuntu-fan
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  containerd docker.io runc
The following NEW packages will be installed:
  containerd.io
0 upgraded, 1 newly installed, 3 to remove and 6 not upgraded.
Need to get 27.7 MB of archives.
After this operation, 172 MB disk space will be freed.
Do you want to continue? [Y/n] y
Get:1 https://download.docker.com/linux/ubuntu jammy/stable amd64 containerd.io amd64 1.6.15-1 [27.7 MB]
Fetched 27.7 MB in 1s (29.5 MB/s)        
(Reading database ... 109876 files and directories currently installed.)
Removing docker.io (20.10.12-0ubuntu4) ...
'/usr/share/docker.io/contrib/nuke-graph-directory.sh' -> '/var/lib/docker/nuke-graph-directory.sh'
Warning: Stopping docker.service, but it can still be activated by:
  docker.socket
Removing containerd (1.5.9-0ubuntu3.1) ...
Removing runc (1.1.0-0ubuntu1.1) ...
Selecting previously unselected package containerd.io.
(Reading database ... 109614 files and directories currently installed.)
Preparing to unpack .../containerd.io_1.6.15-1_amd64.deb ...
Unpacking containerd.io (1.6.15-1) ...
Setting up containerd.io (1.6.15-1) ...

Configuration file '/etc/containerd/config.toml'
 ==> File on system created by you or by a script.
 ==> File also in package provided by package maintainer.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** config.toml (Y/I/N/O/D/Z) [default=N] ? i
Installing new version of config file /etc/containerd/config.toml ...
Processing triggers for man-db (2.10.2-1) ...
Scanning processes...                                                                                                                                                     
Scanning candidates...                                                                                                                                                    
Scanning linux images...                                                                                                                                                  

Restarting services...
 systemctl restart containerd.service
Service restarts being deferred:
 systemctl restart networkd-dispatcher.service
 systemctl restart systemd-logind.service
 systemctl restart unattended-upgrades.service
 systemctl restart user@1000.service

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
imksoo@k8smaster:~$ 

パッケージのインストールで初期化したコンフィグファイルを改めて修正しておきます。
( SystemdCgroup = true にする)

imksoo@k8smaster:~$ sudo sh -c "containerd config default > /etc/containerd/config.toml"
imksoo@k8smaster:~$ sudo vim /etc/containerd/config.toml
/etc/containerd/config.toml
 [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
            BinaryName = ""
            CriuImagePath = ""
            CriuPath = ""
            CriuWorkPath = ""
            IoGid = 0
            IoUid = 0
            NoNewKeyring = false
            NoPivotRoot = false
            Root = ""
            ShimCgroup = ""
            SystemdCgroup = true # falseから変更する

containerd サービスを再起動しておきます。

imksoo@k8smaster:~$ sudo systemctl restart containerd.service 

Discussion