【问题标题】:Error while restart Apache2 inside the container在容器内重新启动 Apache2 时出错
【发布时间】:2020-02-13 06:34:45
【问题描述】:

在配置文件后尝试在 docker 容器中创建灯堆栈 当尝试使用命令重新启动时

service apache2 restart 

报错

[....] Restarting Apache httpd web server: apache2/usr/sbin/apache2ctl: 99: ulimit: error setting limit (Operation not permitted)
Setting ulimit failed. See README.Debian for more information.
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
 failed!

即使我已经尝试过

service apache2 reload
apache2 graceful

【问题讨论】:

  • 另外,看起来像是权限问题。

标签: linux apache docker containers httpd.conf


【解决方案1】:

其他东西明显在使用端口,试试这个命令找出谁在使用80端口

netstat -plnt

如果您不使用该应用程序,则将其终止。

kill -15 <pid>

然后你再次重启 apache 服务器

service apache2 reload

希望对你有帮助!

【讨论】:

    【解决方案2】:

    您几乎从不在 Docker 容器周围使用 servicesystemctl 之类的命令。如果需要重启容器中运行的服务,停止、删除、重启容器

    docker stop my-apache
    docker rm my-apache
    docker run --name my-apache -p ... -v ... httpd:2.4
    

    以这种方式删除和重新启动容器非常常规。 我的示例docker run 命令有一个占位符-v 选项;通常你会使用它在启动时将配置注入容器,这样当你删除容器时不会丢失任何东西。

    【讨论】:

      猜你喜欢
      • 2020-07-29
      • 1970-01-01
      • 1970-01-01
      • 2019-08-21
      • 2020-09-20
      • 2020-01-21
      • 2018-03-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多