[root@corpse ~]#docker run -it tomcat:latest
WARNING: IPv4 forwarding is disabled. Networking will not work.
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/openjdk-11
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
方法:
# vim /usr/lib/sysctl.d/00-system.conf
添加:net.ipv4.ip_forward=1
Linux的内核参数net.ipv4.ip_forward参数指定了Linux系统当前对路由转发功能的支持情况;其值为0时表示禁止进行IP转发;是1,IP转发功能已经打开。
[root@corpse ~]# echo "net.ipv4.ip_forward=1" >>/usr/lib/sysctl.d/00-system.conf
[root@corpse ~]# systemctl restart network