Score:2

How to start containerd as a service after yum install?

jp flag

I installed containerd on Amazon Linux 2 using the suggested commands:

sudo amazon-linux-extras enable docker
sudo yum install -y containerd

I added this in the EC2 user data script to run at instance launch time.

But, how am I supposed to start containerd (a container runtime - similar to docker) as a service? Since I installed through yum there doesn't seem to include a systemd service file. The binary is located on /usr/bin/containerd. Am I supposed to use echo in the boot script to generate a systemd service file or what is a good practice?

in flag
I could be wrong, but I don't think the containerd is really designed to be used without docker or kubernetes or something else. I thought it was just the runtime component other things use.
Score:1
jp flag

I ended up with adding these lines to the startup script:

cat <<EOF | sudo tee /etc/systemd/system/containerd.service
[Unit]
Description=containerd
Documentation=https://containerd.io

[Service]
Type=notify
ExecStart=/usr/bin/containerd

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl enable containerd
sudo systemctl start containerd

Looks like the containerd service was started:

$ sudo ctr version
Client:
  Version:  1.4.6
  Revision: d71fcd7d8303cbf684402823e425e9dd2e99285d
  Go version: go1.15.12

Server:
  Version:  1.4.6
  Revision: d71fcd7d8303cbf684402823e425e9dd2e99285d
  UUID: 25f1bff3-b72d-45f2-99d2-78c0df126faa
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.