CentOS 上安装Docker
时间: 2024-05-09 09:19:45 浏览: 76
以下是在CentOS上安装Docker的步骤:
1. 卸载旧版本的Docker:
```bash
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
```
2. 安装依赖:
```bash
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
```
3. 添加Docker的官方仓库:
```bash
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
```
4. 安装Docker:
```bash
sudo yum install docker-ce docker-ce-cli containerd.io
```
5. 启动Docker服务:
```bash
sudo systemctl start docker
```
6. 验证Docker是否安装成功:
```bash
sudo docker run hello-world
```
如果一切正常,将会输出以下信息:
```
Hello from Docker!
This message shows that your installation appears to be working correctly.
...
```
至此,Docker已经成功安装在CentOS上。
阅读全文