【发布时间】:2017-07-13 13:53:06
【问题描述】:
我有一个简单的 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 中的缺失,但这并没有帮助。
提前感谢您的帮助。
【问题讨论】:
-
CMD 中有印刷引号 (
“ ”),请使用直引号 (")。 -
非常感谢!现在可以了