docker的ipv4转发问题

新建好apache服务器image之后新建docker容器发现报错了:

 docker run -it --rm --name apache-container -p 80:80 apache2-image
WARNING: IPv4 forwarding is disabled. Networking will not work.
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
[Fri May 11 01:54:01.097035 2018] [mpm_event:notice] [pid 1:tid 139641554196352] AH00489: Apache/2.4.33 (Unix) configured -- resuming normal operations
[Fri May 11 01:54:01.097163 2018] [core:notice] [pid 1:tid 139641554196352] AH00094: Command line: 'httpd -D FOREGROUND'
[Fri May 11 01:54:01.106310 2018] [mpm_event:notice] [pid 1:tid 139641554196352] AH00492: caught SIGWINCH, shutting down gracefully
[Fri May 11 01:54:02.108171 2018] [core:notice] [pid 1:tid 139641554196352] AH00052: child pid 6 exit signal Segmentation fault (11)
[Fri May 11 01:54:02.108201 2018] [core:notice] [pid 1:tid 139641554196352] AH00052: child pid 7 exit signal Segmentation fault (11)
[Fri May 11 01:54:02.108206 2018] [core:notice] [pid 1:tid 139641554196352] AH00052: child pid 8 exit signal Segmentation fault (11)

解决方案:

从第一个提示入手先解决IPv4转发问题,修改配置文件

sudo vim /etc/sysctl.conf
# 解决问题 IPv4 forwarding is disabled. Networking will not work.
net.ipv4.ip_forward=1

重启网络配置并检测是否成功

systemctl restart network
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or units.
Authenticating as: root
Password: 
==== AUTHENTICATION COMPLETE ===
[test@localhost ~]$ sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1

重新创建docker容器该问题已经解决还有剩下的问题

docker run -it --rm --name apache-container -p 80:80 apache2-image
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
[Fri May 11 02:23:23.660776 2018] [mpm_event:notice] [pid 1:tid 140231941244800] AH00489: Apache/2.4.33 (Unix) configured -- resuming normal operations
[Fri May 11 02:23:23.661543 2018] [core:notice] [pid 1:tid 140231941244800] AH00094: Command line: 'httpd -D FOREGROUND'
[Fri May 11 02:23:23.668218 2018] [mpm_event:notice] [pid 1:tid 140231941244800] AH00492: caught SIGWINCH, shutting down gracefully
[Fri May 11 02:23:24.669358 2018] [core:notice] [pid 1:tid 140231941244800] AH00052: child pid 6 exit signal Segmentation fault (11)
[Fri May 11 02:23:24.669383 2018] [core:notice] [pid 1:tid 140231941244800] AH00052: child pid 7 exit signal Segmentation fault (11)
[Fri May 11 02:23:24.669388 2018] [core:notice] [pid 1:tid 140231941244800] AH00052: child pid 8 exit signal Segmentation fault (11)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值