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



我要自动回答"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

错误来自部件

apt-get install wget

您可以通过添加-y选项来自动提示yes。

apt-get install -y wget

相关内容

  • 没有找到相关文章

最新更新