hello

cri-dockerd 설치 스크립트

cri-dockerd 설치 스크립트 for ubuntu

#!/bin/bash

# cri-dockerd 설치 스크립트 for Ubuntu

# 필요한 패키지 설치
sudo apt-get update && sudo apt-get install -y curl jq

# GitHub API를 통해 cri-dockerd의 최신 릴리스 버전 가져오기
CRI_DOCKERD_REPO="Mirantis/cri-dockerd"
CRI_DOCKERD_LATEST_RELEASE_INFO=$(curl -s https://api.github.com/repos/${CRI_DOCKERD_REPO}/releases/latest)
CRI_DOCKERD_VERSION=$(echo ${CRI_DOCKERD_LATEST_RELEASE_INFO} | jq -r '.tag_name')

CRI_DOCKERD_DOWNLOAD_URL=$(echo ${CRI_DOCKERD_LATEST_RELEASE_INFO} | jq -r '.assets[] | select(.name | test("amd64\\.tgz$")) | select(.name | contains("darwin") | not) | .browser_download_url')


# 다운로드 URL 확인
if [ -z "$CRI_DOCKERD_DOWNLOAD_URL" ]; then
  echo "다운로드 URL을 찾을 수 없습니다."
  exit 1
fi

echo "***************************************"
echo $CRI_DOCKERD_DOWNLOAD_URL
echo "***************************************"

curl -L ${CRI_DOCKERD_DOWNLOAD_URL} | sudo tar -xz --strip-components=1 -C /usr/bin cri-dockerd/cri-dockerd

sudo curl -L "https://raw.githubusercontent.com/${CRI_DOCKERD_REPO}/${CRI_DOCKERD_VERSION}/packaging/systemd/cri-docker.service" -o /etc/systemd/system/cri-docker.service
sudo curl -L "https://raw.githubusercontent.com/${CRI_DOCKERD_REPO}/${CRI_DOCKERD_VERSION}/packaging/systemd/cri-docker.socket" -o /etc/systemd/system/cri-docker.socket

# systemd에 cri-docker 서비스 등록 및 시작
sudo systemctl daemon-reload
sudo systemctl enable cri-docker.service
sudo systemctl enable --now cri-docker.socket

echo "cri-dockerd ${CRI_DOCKERD_VERSION} 설치가 완료되었습니다."