docker容器作为虚拟机使用
1、yum -y install docker2、宿主机网卡桥接参考:https://blog.csdn.net/fgf00/article/details/52575500https://blog.csdn.net/bobpen/article/details/68941207cd /etc/sysconfig/network-scripts/cp ifcfg-eth0 ...
1、yum -y install docker
2、宿主机网卡桥接
参考:
https://blog.csdn.net/fgf00/article/details/52575500
https://blog.csdn.net/bobpen/article/details/68941207
cd /etc/sysconfig/network-scripts/
cp ifcfg-eth0 ifcfg-eth0.bak
cp ifcft-eth0 ifcfg-br0
ifcfg-eth0配置样例如下:
cat ifcfg-p2p1
BOOTPROTO=none
DEVICE=p2p1
NM_CONTROLLED=no
ONBOOT=yes
BRIDGE=br0
ifcfg-br0配置样例如下:
cat ifcfg-br0
DEVICE=br0
TYPE=Bridge
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.140.3
NETMASK=255.255.255.0
GATEWAY=192.168.140.1
DNS1=192.168.140.254
DNS2=114.114.114.114
NM_CONTROLLED=no
3、启动docker容器
4、pipework br0 centos7 192.168.140.4/24@192.168.140.1
(绑定局域网ip到容器上)
pipwork安装参考:
cd /home/pipework/
wget -O pipework-master.zip https://codeload.github.com/jpetazzo/pipework/zip/master
# 若没有unzip命令,安装 yum install -y unzip zip
unzip pipework-master.zip
cp -p pipework-master/pipework /usr/local/bin/
5、修改resolve参数
6、进入容器:yum install epel-release openssh-server
7、开启ssh服务,ssh远程。
更多推荐
所有评论(0)