一芯勘、使用官方安裝腳本自動(dòng)安裝 (僅適用于公網(wǎng)環(huán)境)
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
二澳叉、手動(dòng)安裝
Ubuntu 14.04 16.04 (使用apt-get進(jìn)行安裝)
# step 1: 安裝必要的一些系統(tǒng)工具
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
# step 2: 安裝GPG證書
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
# Step 3: 寫入軟件源信息
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
# Step 4: 更新并安裝 Docker-CE
sudo apt-get -y update
sudo apt-get -y install docker-ce
CentOS 7 (使用yum進(jìn)行安裝)
# step 1: 安裝必要的一些系統(tǒng)工具
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
# Step 2: 添加軟件源信息
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# Step 3: 更新并安裝 Docker-CE
sudo yum makecache fast
sudo yum -y install docker-ce
# Step 4: 開啟Docker服務(wù)
sudo service docker start
三拘央、安裝校驗(yàn)
執(zhí)行命令:docker version
四倔既、Docker啟動(dòng)醋安、停止等命令
- 開啟Docker服務(wù)
service docker start
或systemctl start docker
或systemctl start docker.service
- 查看Docker啟動(dòng)狀態(tài)
systemctl status docker
- 設(shè)置Docker開啟自啟動(dòng)
systemctl enable docker
- 停止Docker服務(wù)
service docker stop
或systemctl stop docker
- 重啟Docker服務(wù)
service docker restart
或systemctl restart docker
五召夹、參考資料
CentOS幫助連接
Ubuntu幫助鏈接
Debian幫助鏈接
Fedora幫助鏈接
【參考文檔】:Docker CE 鏡像源站