- 系统 centOS 7
- 初始化系统时,虚拟机不能联网,后通过配置网络文件成功联网。
cd /etc/sysconfig/network-scripts/
ls
vi ifcfg-ens33
修改ONBOOT=yes # 自动启用网络
- 联网后,通过yum命令安装仓库
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Install required packages. yum-utils provides the yum-config-manager utility, and device-mapper-persistent-data and lvm2 are required by the devicemapper storage driver
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo #set up the stable repository
sudo yum-config-manager --enable docker-ce-test #启用仓库,可通过 --disable 关闭
- 安装 docker ce
sudo yum isntall docker-ce
sudo yum install docker-ce-<VERSION STRING> 可安装指定版本
- 启用docker
sudo systemctl start docker
- 验证docker已正确安装
sudo docker run hello-world
sudo docker info