Docker的安裝與使用

2020-10-13 18:00:23

Docker的安裝與使用

1.刪除環境老版本docker
$ sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine
                  
2.設定倉庫地址
$ sudo yum install -y yum-utils
$ sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
    
3.安裝docker引擎
$ sudo yum install docker-ce docker-ce-cli containerd.io

4.啟動docker
sudo systemctl start docker

5.設定docker開機自啟
sudo systemctl enable docker

6.設定阿里雲映象加速器
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://y8vu269j.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

7.未完待續。。。

docker官網:https://docs.docker.com/engine/install/centos/