sudo apt-get remove docker docker-engine docker.io containerd runc
本操作基于如下环境:
卸载之前的docker
sudo apt-get remove docker docker-engine docker.io containerd runc
安装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 -
:添加 Docker 的官方 GPG 密钥sudo apt-key fingerprint 0EBFCD88
:验证您现在是否拥有带有指纹的密钥sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
:设置稳定版仓库安装 Docker Engine-Community
sudo apt-get update
:更新sudo apt-get install docker-ce
:安装最新的Docker-cesudo systemctl enable docker
sudo systemctl start docker
测试
sudo docker run hello-world
通过docker中的容器隔离机制我们实现mysql的主从复制,从而避免了单点故障