问题描述
我有一个简单的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 .
效果很好,但是当我想用
That works quite well, but when I want to execute it with
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/
这篇关于& quot;/bin/sh:1:["apache2ctl" ,:找不到& quot;在码头工人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!