修改静态IP
cd /etc/sysconfig/network-scripts/
vim ifcfg-ens33
文件内容:
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
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="78d66a02-f2cc-49d6-9357-3e2cf39b9484"
DEVICE="ens33"
ONBOOT="yes"
# 将190改为你的网关号
IPADDR="192.168.190.151" #ip地址
GATEWAY="192.168.190.2" #网关(网络关卡)
NETMASK="255.255.255.0" #子网掩码
DNS1="192.168.190.2"
IPADDR="192.168.163.140" #ip地址
GATEWAY="192.168.163.2" #网关(网络关卡)
NETMASK="255.255.255.0" #子网掩码
DNS1="192.168.163.2"
systemctl restart network
systemctl stop firewalld
systemctl disable firewalld
IPV4开启
vi /etc/sysctl.conf
net.ipv4.ip_forward=1 #最下方添加这段代码
#重启network服务
systemctl restart network && systemctl restart docker
#查看是否修改成功 (备注:返回1,就是成功)
[root@docker-node2 ~]# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1
version: '3'
services:
web:
build: .
ports:
- "8080:8080"
depends_on:
- db
- redis
# redis服务
redis:
image: redis
# mysql服务
db:
image: mysql:5.7