Docker镜像apache服务启动失败
问题描述:
docker pull centos:latest
docker -t -i centos:latest /bin/bash
bash-4.2# yum install httpd
........
经过漫长的等待终于安装完毕,于是我想启动apache服务,但是发现:
/etc/httpd start
提示
bash-4.2# /etc/httpd start
bash: /etc/httpd: Is a directory
尝试这样启动:
bash-4.2# /usr/sbin/apachectl start
/usr/sbin/apachectl: line 112: /usr/bin/systemctl: No such file or directory
检查一下:
bash-4.2# rpm -qa | grep httpd
httpd-tools-2.4.6-19.el7.centos.x86_64
httpd-2.4.6-19.el7.centos.x86_64
Apache应该是安装完毕了。
希望大家能帮我解决这个问题,或者是否是我哪里做的不对?
2 个回复
徐新坤 - 京东商城-TIG-JDOS团队
赞同来自: 田浩浩
难道不应该是/etc/init.d/httpd start么?
如果是centos7。要使用systemctl start httpd。
Sonyfe25cp
赞同来自:
同样觉得/etc/httpd start 这个不对..
按照你的步骤,刚才操作了一次。
/etc/httpd 确实是个目录,里面有bin,conf 这些文件。
通过/usr/sbin/httpd 启动,报错,提示没有/var/www/html 文件夹,因为默认的DocumentRoot在这里,创建之;然后/etc/httpd/logs权限不对,这个link到 var/log/httpd的,删掉该文件,创建/etc/httpd/logs文件夹,重新/usr/sbin/httpd 启动成功。
哎,其实一点坑都没有,自己认真看一下提示的错误信息分分钟就懂了。