本文介绍了"/bin/sh: 1: ["apache2ctl",: not found";在码头工人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个简单的 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.
在此先感谢您的帮助.
推荐答案
更改此行
CMD [apache2ctl", -D FOREGROUND"]
到
CMD ["apache2ctl", "-D","FOREGROUND"]
顺便说一下,您应该将 RUN 分组,参见
You should group your RUN, by the way, see
https://docs.docker.com/engine/用户指南/eng-image/dockerfile_best-practices/
这篇关于"/bin/sh: 1: ["apache2ctl",: not found";在码头工人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!