命令 '/bin/sh -c chmod +x a.deb && apt-get install a.deb' 返回非零代码:1

时间:2021-08-01 13:02:33

标签: docker docker-compose dockerfile

我一直在尝试为 .deb 文件编写 dockerfile。这是我到目前为止所写的:

FROM ubuntu:18.04 AS ubuntu

RUN apt-get update

WORKDIR /invisily

COPY . ./

USER root
RUN chmod +x a.deb && \
    apt-get install a.deb

所有阶段都运行良好,但最后我收到一条错误消息:

Need to get 79.6 MB of archives.
After this operation, 296 MB of additional disk space will be used.
Do you want to continue? [Y/n] Abort.
The command '/bin/sh -c chmod +x a.deb &&     apt-get install a.deb' returned a non-zero code: 1

这可能是什么原因?

1 个答案:

答案 0 :(得分:0)

您的 -y 命令中缺少 apt-get 以自动接受确认问题并以非交互方式运行。

正如您从日志中看到的那样,apt-get 正在向用户提出一个问题(期望通过键盘得到 Y/N 答案),但由于没有与用户进行交互,因此它被中止。