linux - 在 Dockerfile 中使用 wget 时如何自动回答 'Yes'?

标签 linux docker ubuntu superuser

这个问题在这里已经有了答案:





The command '/bin/sh -c apt-get install erlang' returned a non-zero code: 1

(1 个回答)


10 个月前关闭。




在以下情况下,我想自动回答“Y”,但我不确定如何正确执行。
我试过yes Y | wget ... , echo y | wget ...但似乎没有任何效果。在这种特殊情况下,我可能做错了。
这是我运行时的输出 docker-compose up --build :

> [webapp_local_node 5/7] RUN apt-get update && apt-get install wget     && wget http://sourceforge.net/projects/libpng/files/libpng16/1.6.32/libpng-1.6.32.tar.gz/download -O libpng.tar.gz && tar -xvf libpng.tar.gz && cd libpng-1.6.32 && bash configure --prefix=/usr --disable-static && make install && apt autoremove     && rm -rf /var/lib/apt/lists/*:
#15 0.574 Get:1 http://security.debian.org/debian-security stretch/updates InRelease [53.0 kB]
#15 0.702 Ign:2 http://deb.debian.org/debian stretch InRelease
#15 0.778 Get:3 http://deb.debian.org/debian stretch-updates InRelease [93.6 kB]
#15 0.830 Get:4 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [709 kB]
#15 0.951 Get:5 http://deb.debian.org/debian stretch Release [118 kB]
#15 1.091 Get:6 http://deb.debian.org/debian stretch Release.gpg [3177 B]
#15 1.277 Get:7 http://deb.debian.org/debian stretch/main amd64 Packages [7080 kB]
#15 3.518 Fetched 8057 kB in 3s (2620 kB/s)
#15 3.518 Reading package lists...
#15 4.245 Reading package lists...
#15 4.961 Building dependency tree...
#15 5.105 Reading state information...
#15 5.216 The following package was automatically installed and is no longer required:
#15 5.216   xz-utils
#15 5.216 Use 'apt autoremove' to remove it.
#15 5.216 The following additional packages will be installed:
#15 5.216   ca-certificates libffi6 libgmp10 libgnutls30 libhogweed4 libidn11 libidn2-0
#15 5.218   libnettle6 libp11-kit0 libpsl5 libssl1.1 libtasn1-6 libunistring0 openssl
#15 5.218   publicsuffix
#15 5.221 Suggested packages:
#15 5.221   gnutls-bin
#15 5.353 The following NEW packages will be installed:
#15 5.354   ca-certificates libffi6 libgmp10 libgnutls30 libhogweed4 libidn11 libidn2-0
#15 5.355   libnettle6 libp11-kit0 libpsl5 libssl1.1 libtasn1-6 libunistring0 openssl
#15 5.356   publicsuffix wget
#15 5.363 0 upgraded, 16 newly installed, 0 to remove and 0 not upgraded.
#15 5.363 Need to get 5341 kB of archives.
#15 5.363 After this operation, 14.6 MB of additional disk space will be used.
#15 5.363 Do you want to continue? [Y/n] Abort.
------
failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c apt-get update && apt-get install wget     && wget http://sourceforge.net/projects/libpng/files/libpng16/1.6.32/libpng-1.6.32.tar.gz/download -O libpng.tar.gz && tar -xvf libpng.tar.gz && cd libpng-1.6.32 && bash configure --prefix=/usr --disable-static && make install && apt autoremove     && rm -rf /var/lib/apt/lists/*]: exit code: 1

Dockerfile
FROM node:12-slim

RUN npm i npm@latest -g

WORKDIR /usr/src

COPY ./app/package.json ./

RUN apt-get update && apt-get install wget \
    && wget http://sourceforge.net/projects/libpng/files/libpng16/1.6.32/libpng-1.6.32.tar.gz/download -O libpng.tar.gz && tar -xvf libpng.tar.gz && cd libpng-1.6.32 && bash configure --prefix=/usr --disable-static && make install && apt autoremove \
    && rm -rf /var/lib/apt/lists/*

ENV PATH /usr/src/node_modules/.bin/:$PATH

WORKDIR /usr/src/app

COPY . .

最佳答案

提示来自 wget 的安装。您可以添加 -y切换,所以它变成

apt-get install -y wget

关于linux - 在 Dockerfile 中使用 wget 时如何自动回答 'Yes'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68902213/

相关文章:

mysql - mysqladmin 和 password() 函数之间的哈希值不同

linux - db2 查询在不同的环境中花费不同的时间

linux - 建议任何方法使可执行文件在 64 位上构建并在 32 位 ubuntu 上运行

docker - 尝试设置新的 ECS 集群时,容器正在连接默认集群

ubuntu - Ubuntu 和 Manjaro 之间的终端命令区别

ubuntu - AWS CLI 中没有 ECS 选项?

linux - tiny6410 的触摸屏在 linux 上不工作

docker - 如何通过 Go SDK 流式传输 Docker 容器日志

node.js - 如何使用 NGINX 访问写入 docker 容器卷上的文件并将 URL 共享到客户端

php - 无法在php中显示任何错误