skip to Main Content

I want to auto-answer "Y" in the case below, but I’m not sure how to do it right.

I tried yes Y | wget ..., echo y | wget ... yet nothing seems to work. I’m likely doing it wrong in this particular situation.

This is the output when I’m running 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 . .

2

Answers


  1. The prompt is from the installation of wget. You can add the -y switch so it becomes

    apt-get install -y wget
    
    Login or Signup to reply.
  2. The error is coming from the part

    apt-get install wget
    

    You can auto prompt to yes by adding the -y option.

    apt-get install -y wget
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search