docker安裝指令碼
阿新 • • 發佈:2020-08-13
#!/usr/bin/env bash DOCKER_CE_VERSION=18.09.6-3.el7 DOCKER_CE_CLI_VERSION=18.09.6-3.el7 # 解除安裝舊版本 yum -y remove docker-ce.x86_64 yum -y remove containerd.io.x86_64 yum -y remove docker-ce-cli.x86_64 # 安裝所需軟體包 yum install -y yum-utils \ device-mapper-persistent-data \ lvm2 # 設定儲存庫 yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo # 安裝最新版的docker-ce yum -y install docker-ce-$DOCKER_CE_VERSION docker-ce-cli-$DOCKER_CE_CLI_VERSION containerd.io # 配置阿里雲docker映象加速器,配置私有映象倉庫地址 mkdir -p /etc/docker tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://8auvmfwy.mirror.aliyuncs.com"], "exec-opts": ["native.cgroupdriver=systemd"], "insecure-registries": ["192.168.**.**:7080"] } EOF # 重新載入配置、重啟docker systemctl daemon-reload systemctl restart docker