从官网上下来的httpd Docker镜像,无法正常启动,运行出现AH00558错误:

从官网上下来的httpd镜像,运行出现AH00558错误:

   [root@iZ8vbj4bz0agbpf0srv52nZ apache2_image]# docker run -it --rm  httpd
    AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.24. 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.24. Set the 'ServerName' directive globally to suppress this message
    [Thu Jan 03 07:58:52.354697 2019] [mpm_event:notice] [pid 1:tid 140595899299008] AH00489: Apache/2.4.37 (Unix) configured -- resuming normal operations
    [Thu Jan 03 07:58:52.354827 2019] [core:notice] [pid 1:tid 140595899299008] AH00094: Command line: 'httpd -D FOREGROUND'
    [Thu Jan 03 07:58:52.367200 2019] [mpm_event:notice] [pid 1:tid 140595899299008] AH00492: caught SIGWINCH, shutting down gracefully

首先,用vim打开apache的配置文件(根据个人情况来找到配置文件,centos的系统默认在/etc/httpd/conf/httpd.conf,但我下的httpd标准镜像在/usr/local/apache2/conf/httpd.conf)
然后,使用vim的/搜索命令,搜索ServerName关键字
使用vim的yy命令复制上图所示的行,按p键粘贴,然后去掉开头的#号,将www.example.com替换为localhost,
设置完成后,wq!命令退出vim,再次检查apache配置,就不会再有这个错误提示了。

如果是写在Dockerfile文件里,则是:
RUN sed -i ‘s/#ServerName www.example.com:80/ServerName localhost:80/g’ /usr/local/apache2/conf/httpd.conf

你可能感兴趣的:(docker)