La configuración del contenedor ventana acoplable y el mismo host de red
Host IP: 192.168.43.39
Configuración de la red
[root@CentOS7-39 network-scripts]# cat ifcfg-br0
TYPE="Bridge"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="none"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="br0"
UUID="fc9c13c1-c71a-4dc5-a82f-056aef34ff77"
DEVICE="br0"
ONBOOT="yes"
IPADDR="192.168.43.39"
PREFIX="24"
GATEWAY="192.168.43.2"
DNS1="192.168.43.2"
IPV6_PRIVACY="no"
[root@CentOS7-39 network-scripts]# cat ifcfg-ens33
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="none"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
#UUID="fc9c13c1-c71a-4dc5-a82f-056aef34ff77"
DEVICE="ens33"
ONBOOT="yes"
#IPADDR="192.168.43.39"
#PREFIX="24"
#GATEWAY="192.168.43.2"
#DNS1="192.168.43.2"
IPV6_PRIVACY="no"
BRIDGE=br0
pipwork instalación
git clone https://github.com/jpetazzo/pipework
cp pipework/pipework /usr/local/bin/
envase abierto
docker run -itd --net=none --name peng centos8 bash
Ip y configuración de la pasarela
pipework br0 peng 192.168.43.100/[email protected]
Vista del recipiente ip Peng
[root@1f9b8ca46f55 /]# yum install passwd openssh-server -y
[root@1f9b8ca46f55 /]# passwd //给root设置密码
启动 sshd 服务失败
estibador rm -f Peng
ventana acoplable plazo -ITD --net = ninguno --name = Peng --privileged -e “contenedor = ventana acoplable” centos8 / usr / sbin / init
ventana acoplable ejecutivo -es Peng fiesta
[root @ de4add735c8b /] # exit
[root @ CentOS7-39 ~] # tuberías br0 Peng 192.168.43.100/[email protected]
[root @ de4add735c8b /] # yum install -y passwd openssh-server
[root @ de4add735c8b /] # inicio systemctl sshd
Peng conectado remotamente al contenedor en un huésped 192.168.43.39 ip es 192.168.43.100