docker安装
Ubuntu安装docker:
配置Ubuntu源:
cp -a /etc/apt/sources.list /etc/apt/sources.list.bak sed -i "s@http://.*archive.ubuntu.com@https://mirrors.aliyun.com/@g" /etc/apt/sources.list sed -i "s@http://.*security.ubuntu.com@https://mirrors.aliyun.com/@g" /etc/apt/sources.list# 更新 apt-get update && apt-get upgrade
Ubuntu安装docker:
# 更新源及安装依赖 sudo apt update sudo apt install apt-transport-https ca-certificates curl software-properties-common# 添加密钥和仓库 curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"# 安装 Docker sudo apt update sudo apt install docker-ce docker-ce-cli containerd.io
安装cri-dockerd:
root@master:~# wget https://github.com/Mirantis/cri-dockerd/releases/download/v0.3.13/cri-dockerd_0.3.13.3-0.ubuntu-jammy_amd64.deb root@master:~# dpkg -i /home/chasel/cri-dockerd_0.3.13.3-0.ubuntu-jammy_amd64.deb root@master:~# systemctl start cri-docker root@master:~# systemctl status cri-docker root@master:~# systemctl enable cri-docker root@master:~# sed -i 's,^ExecStart.*,& --network-plugin=cni --pod-infra-container-image=registry.aliyuncs.com/google_containers/pause:3.9,' /usr/lib/systemd/system/cri-docker.service root@master:~# systemctl daemon-reload root@master:~# systemctl restart cri-docker
安装docker compose:
wget https://github.com/docker/compose/releases/download/v2.20.0/docker-compose-linux-x86_64 mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose docker-compose --version
centos安装docker:
# 阿里 yum 源 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo yum makecache
安装docker
cd /etc/yum.repos.d/ && wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum install docker-ce -y systemctl start docker systemctl status docker systemctl enable docker
安装cri-dockerd:
wget https://github.com/Mirantis/cri-dockerd/releases/download/v0.3.1/cri-dockerd-0.3.1-3.el7.x86_64.rpm yum install -y cri-dockerd-0.3.1-3.el7.x86_64.rpm sed -i 's,^ExecStart.*,& --network-plugin=cni --pod-infra-container-image=registry.aliyuncs.com/google_containers/pause:3.9,' /usr/lib/systemd/system/cri-docker.service systemctl daemon-reload systemctl start cri-docker systemctl status cri-docker systemctl enable cri-docker