【问题标题】:remaining in implementation of "RUN apt-get update && apt-get install -y apache2"仍在执行“RUN apt-get update && apt-get install -y apache2”
【发布时间】:2021-12-09 03:59:11
【问题描述】:

这是我写的:

FROM ubuntu:20.04
RUN apt-get update && apt-get install -y apache2
ENV APACHE_LOG_DIR /var/log/apache2
VOLUME /var/www/html
EXPOSE 80
ENTRYPOINT ["/usr/sbin/apache2ctl", "-D","FOREGROUND"] 

当我写作时

docker build -t myapache .

它保留在下面部分的实现中,不会改变。

RUN apt-get update && apt-get install -y apache2 

我应该怎么做才能解决这个问题?

【问题讨论】:

    标签: docker dockerfile docker-build


    【解决方案1】:

    因为apt-get 等待用户交互,所以卡在那里。

    尝试设置一个环境变量,告诉apt-get 不要查询任何交互式问题提示。 env 变量的名称是 DEBIAN_FRONTEND,其值应为 noninteractive

    所以试着在前面加上一行:

    ARG DEBIAN_FRONTEND=noninteractive
    

    在您的 RUN dockerfile 指令之前。

    【讨论】:

    • 非常感谢已修复
    • @Golnoosh:考虑将答案标记为已接受,因为该解决方案对您有效。谢谢
    猜你喜欢
    • 1970-01-01
    • 2020-12-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-28
    • 2012-02-14
    相关资源
    最近更新 更多