centos安装docker
yum install wget -y
cd /etc/yum.repos.d/
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum list docker-ce.x86_64 --showduplicates |sort -r
yum install -y docker-ce-18.09.9-3.el7
systemctl daemon-reload
systemctl start docker
docker info
systemctl enable docker
Ubuntu安装docker
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
# 查看docker-ce的版本
apt-cache madison docker-ce
# 查看docker-ce-cli的版本
apt-cache madison docker-ce-cli
# 安装5:18.09.9~3-0~ubuntu-bionic版本的docker
apt-get install docker-ce=5:18.09.9~3-0~ubuntu-bionic docker-ce-cli=5:18.09.9~3-0~ubuntu-bionic containerd.io
systemctl daemon-reload
systemctl start docker
docker info
systemctl enable docker
Ubuntu卸载docker
apt-get purge -y docker-ce docker-ce-cli containerd.io
rm -rf /var/lib/docker
groupdel docker
apt-get autoremove -y
docker --version
如果系统提示 command not found,则表示 Docker 已成功卸载。