容器重启后,httpd服务无法启动

时间:2020-01-21 15:49:06

标签: docker

我的httpd服务没有在容器重启时启动。

Dockerfile

[root@dev devops_pratice]# cat Dockerfile 
FROM custom_centos:6
VOLUME ["/opt/shared/finapp1usr/public_html","/var/www/html/","/opt/shared/finapp1usr/logs","/var/log/httpd"]
CMD ["service httpd start"]
EXPOSE 80 2000

=========================================== ======

我已从此Dockerfile构建映像

[root@dev devops_pratice]# docker build -t custom_centos6:v7 .
Sending build context to Docker daemon  273.9kB
Step 1/4 : FROM custom_centos:6
 ---> 23bfa4993b72
Step 2/4 : VOLUME ["/opt/shared/finapp1usr/public_html","/var/www/html/","/opt/shared/finapp1usr/logs","/var/log/httpd"]
 ---> Using cache
 ---> de74675b273a
Step 3/4 : CMD ["service httpd start"]
 ---> Using cache
 ---> 6b77b5b11feb
Step 4/4 : EXPOSE 80 2000
 ---> Using cache
 ---> 55975ece7996
Successfully built 55975ece7996
Successfully tagged custom_centos6:v7

=========================================== ======

最后,我使用上面的构建映像custom_centos6:v7

运行容器
[root@dev devops_pratice]# docker run -dit --name financeapp1 --restart unless-stopped custom_centos6:v7 /bin/bash
c46bb112d9edb2f42a28c94d028a9cb2bc0903a10879d44dc15e2445fd584b45

=========================================== ======

但是,在检查httpd服务时似乎已死。

[root@dev devops_pratice]# docker exec financeapp1 service httpd status
httpd dead but pid file exists

================================================ ====== 有什么想法吗?

0 个答案:

没有答案