#MySQL主从复制演示-在ubuntu服务器上利用docker启动两个mysql服务
文章目录
一、安装docker
1.1 配置docker仓库
# 第一步:卸载旧版本
sudo apt-get remove docker docker-engine docker.io containerd runc
# 第二步:安装依赖
## 更新
sudo apt-get update
## 安装依赖
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
# 第三步:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# 第四步:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
1.2 安装docker
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
1.3 配置阿里云镜像
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://k8yv8apb.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
docker的几个命令:
sudo systemctl start docker
sudo systemctl stop docker
sudo systemctl re