su - root
rm -f /etc/udev/rules.d/70-persistent-net.rules
cd /etc/sysconfig/network-scripts
#利用dhclient分配IP地址,ifconfig记录分配到的ip地址
#编辑配置文件,添加修改以下内容,由于每台虚拟机配置具体文件名不同,用ls指令查看ifcfg-exxx文件名称修改
vi ifcfg-enoXXXXXXX
#dhcp换为none,这里如果需要固定ip推荐用static,
BOOTPROTO=static
#开机是否自动启动
ONBOOT=yes
#生成的mac地址,此处就是在启动虚拟机前在网络适配器中生成的那个MAC地址(没记住的回去再看)
HWADDR=00:50:56:3A:E4:13
#设置自己喜欢的ip地址,但要保持在同一个网段(虚拟机网段的查看方式打开VM的工具--虚拟网络编辑器,下面的参数在工具中可以看到)
#推荐使用dhclient分配的ip地址,不容易发生冲突
IPADDR=dhclient分配的ip地址
#网卡对应的网络掩码
NETMASK=255.255.255.0
#网关保持在同一网段
GATEWAY=分配ip地址前6位.1或2
#DNS1服务器地址,保持在同一个网段,末尾设置为2
DNS1=192.168.124.2 或119.29.29.29
#这两个GATEWAY,DNS必须按照上面的规则设置,否则是无法ping通的
:wq #回车
service network restart
或systemctl restart network.service
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service
uname -r
yum -y update
sudo yum remove docker docker-common docker-selinux docker-engine
No Match for argument: docker
No Match for argument: docker-common
No Match for argument: docker-selinux
No Match for argument: docker-engine
No Packages marked for removal
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
注:如果国内服务器,可以将https://download.docker.com/linux/ 替换为 https://mirrors.aliyun.com/docker-ce/linux/
无论哪个服务器,下载的docker-ce.repo文件内容是一样的,此处用阿里的
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum-config-manager --enable docker-ce-edge
sudo yum-config-manager --disable docker-ce-edge
yum list docker-ce --showduplicates|sort -r
sudo yum install docker-ce
yum -y install docker-ce-18.06.0.ce-3.el7
wget https://download.docker.com/linux/centos/7/x86_64/edge/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm
yum -y install containerd.io-1.2.6-3.3.el7.x86_64.rpm
yum -y install docker-ce
手动下载,手动安装
wget http://mirrors.aliyun.com/docker-engine/yum/repo/main/centos/7/Packages/docker-engine-17.03.0.ce-1.el7.centos.x86_64.rpm
yum install docker-engine-17.03.0.ce-1.el7.centos.x86_64.rpm
systemctl start docker
systemctl enable docker
docker version
sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
...
Hello from Docker!
This message shows that your installation appears to be working correctly.
...