linux 安装 docker环境
时间: 2023-11-29 09:47:47 浏览: 92
以下是在CentOS上安装Docker CE的步骤:
1.卸载旧版本的Docker(如果有):
```shell
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine \
docker-ce
```
2.安装必要的依赖包:
```shell
yum install -y yum-utils device-mapper-persistent-data lvm2
```
3.添加Docker CE的yum源:
```shell
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
```
4.安装Docker CE:
```shell
yum install docker-ce
```
5.启动Docker服务并设置开机自启:
```shell
systemctl start docker
systemctl enable docker
```
6.验证Docker是否安装成功:
```shell
docker version
```
如果成功安装,会输出Docker的版本信息。
阅读全文