Skip to content

Instantly share code, notes, and snippets.

@inductor
Created November 18, 2023 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inductor/1acdde825487cfd7707ee92c3b22078e to your computer and use it in GitHub Desktop.
Save inductor/1acdde825487cfd7707ee92c3b22078e to your computer and use it in GitHub Desktop.
containerd2.sh
#/bin/bash
ARCH="amd64"
OS="linux"
CONTAINERD_VERSION="2.0.0-beta.0"
RUNC_VERSION="1.1.10"
CNI_VERSION="1.3.0"
cd /tmp
# Install containerd
curl -LO https://github.com/containerd/containerd/releases/download/v${CONTAINERD_VERSION}/containerd-${CONTAINERD_VERSION}-${OS}-${ARCH}.tar.gz
sudo tar Cxzvf /usr/local containerd-${CONTAINERD_VERSION}-${OS}-${ARCH}.tar.gz
# Configure containerd
sudo mkdir -p /etc/containerd
sudo containerd config default | sudo tee /etc/containerd/config.toml > /dev/null
if grep -q "SystemdCgroup = true" "/etc/containerd/config.toml"; then
echo "Config found, skip rewriting..."
else
sed -i -e "s/SystemdCgroup \= false/SystemdCgroup \= true/g" /etc/containerd/config.toml
fi
curl -L https://raw.githubusercontent.com/containerd/containerd/main/containerd.service -o /lib/systemd/system/containerd.service
sudo systemctl daemon-reload
sudo systemctl enable --now containerd
# install runc
curl -LO https://github.com/opencontainers/runc/releases/download/v${RUNC_VERSION}/runc.${ARCH}
sudo install -m 755 runc.${ARCH} /usr/local/sbin/runc
# install CNI plugin
curl -LO https://github.com/containernetworking/plugins/releases/download/v${CNI_VERSION}/cni-plugins-${OS}-${ARCH}-v${CNI_VERSION}.tgz
sudo mkdir -p /opt/cni/bin
sudo tar Cxzvf /opt/cni/bin cni-plugins-${OS}-${ARCH}-v${CNI_VERSION}.tgz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment