Last active
April 27, 2025 13:49
-
-
Save crazytaxii/2b2fb634666cab018ef6d7750666910d to your computer and use it in GitHub Desktop.
Deploy containerd only
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CONTAINERD_VERSION="1.7.26" | |
RUNC_VERSION="1.2.5" | |
NERDCTL_VERSION="1.7.6" | |
main() { | |
sudo yum update -y | |
ARCH=$(uname -m | sed -e 's/aarch64/arm64/' -e 's/x86_64/amd64/') | |
# containerd | |
curl -sSL -o /tmp/containerd-linux.tar.gz https://github.com/containerd/containerd/releases/download/v${CONTAINERD_VERSION}/containerd-${CONTAINERD_VERSION}-linux-${ARCH}.tar.gz | |
tar Cxzvf /usr/local /tmp/containerd-linux.tar.gz | |
mkdir -p /etc/containerd | |
containerd config default > /etc/containerd/config.toml | |
sed -i 's/upperdir_label\ =\ false/upperdir_label\ =\ true/g' /etc/containerd/config.toml | |
mkdir -p /usr/local/lib/systemd/system/ | |
cat <<EOF > /usr/local/lib/systemd/system/containerd.service | |
# Copyright The containerd Authors. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
[Unit] | |
Description=containerd container runtime | |
Documentation=https://containerd.io | |
After=network.target dbus.service | |
[Service] | |
ExecStartPre=-/sbin/modprobe overlay | |
ExecStart=/usr/local/bin/containerd | |
Type=notify | |
Delegate=yes | |
KillMode=process | |
Restart=always | |
RestartSec=5 | |
# Having non-zero Limit*s causes performance problems due to accounting overhead | |
# in the kernel. We recommend using cgroups to do container-local accounting. | |
LimitNPROC=infinity | |
LimitCORE=infinity | |
# Comment TasksMax if your systemd version does not supports it. | |
# Only systemd 226 and above support this version. | |
TasksMax=infinity | |
OOMScoreAdjust=-999 | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
systemctl daemon-reload | |
systemctl enable containerd --now | |
# runc | |
curl -sSL -o /usr/local/sbin/runc https://github.com/opencontainers/runc/releases/download/${RUNC_VERSION}/runc.${ARCH} | |
chmod +x /usr/local/sbin/runc | |
# nerdctl | |
curl -sSL -o /tmp/nerdctl.tgz https://github.com/containerd/nerdctl/releases/download/v${NERDCTL_VERSION}/nerdctl-${NERDCTL_VERSION}-linux-${ARCH}.tar.gz | |
tar -xvzf /tmp/nerdctl.tgz -C /usr/local/bin/ | |
chmod +x /usr/local/bin/nerdctl | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment