安装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 device-mapper-persistent-data lvm2
3. 设置yum源:
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
4. 安装最新版本的Docker Engine和containerd:
sudo yum install docker-ce docker-ce-cli containerd.io
- 要安装特定版本的Docker Engine,通过以下命令列出可用版本,然后选择并安装:
yum list docker-ce --showduplicates | sort -r
sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
5. 启动并加入开机启动:
sudo systemctl start docker
sudo systemctl enable docker
6. 验证安装是否成功:
docker version
Docker Compose文档:https://docs.docker.com/compose/install/
安装Docker Compose
1. 运行此命令下载docker compose的当前稳定版本:
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
2. 对二进制文件应用可执行权限:
sudo chmod +x /usr/local/bin/docker-compose
3. 创建软链接:
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
4. 验证安装是否成功:
docker-compose --version
2 comments
怎么收藏这篇文章?
想想你的文章写的特别好