新建好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)