本文介绍了"/bin/sh:1:["apache2ctl" ,:未找到"在码头工人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个简单的Dockerfile
I have a simple Dockerfile
FROM ubuntu
RUN apt-get update
RUN apt-get install -y apache2
RUN apt-get install -y apache2-utils
RUN apt-get clean
RUN apt-get upgrade -y
EXPOSE 80
CMD ["apache2ctl", "-D FOREGROUND"]
我用以下语句构建它
docker build -t mywebserver .
那很好,但是当我想用
docker run -p 80:80 mywebserver
它返回您可以在标题中看到的错误消息.我还尝试了/usr/sbin/apache2ctl
而不是apache2ctl
,以确保不是因为PATH
中的缺失而造成的,但这没有帮助.
it returns the error message you can see in the headline.I also tried /usr/sbin/apache2ctl
instead of apache2ctl
to make sure that it is not because of missing in the PATH
but that did not help.
因此,在此先感谢您的帮助.
So thanks in advance for your help.
推荐答案
更改此行
CMD [apache2ctl, -D FOREGROUND]
到
CMD ["apache2ctl", "-D","FOREGROUND"]
顺便说一下,您应该将RUN分组,请参见
You should group your RUN, by the way, see
https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
这篇关于"/bin/sh:1:["apache2ctl" ,:未找到"在码头工人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!