Reputation: 1543
I am trying to build a docker image from docker file and at one point I run this command in the dockerfile
RUN apt-get upgrade gcc
when I build the image it will get to this point then stop building the image with the output below
91 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 65.3 MB of archives.
After this operation, 7098 kB of additional disk space will be used.
Do you want to continue? [Y/n] Abort.
The command '/bin/sh -c apt-get upgrade gcc' returned a non-zero code: 1
Upvotes: 1
Views: 1421
Reputation: 37994
apt-get upgrade
tries to read user input from the standard input stream, which is not available during a Docker build. You can force apt-get
into a non-interactive mode by using the -y
(alternatively --yes
or --assume-yes
) flag:
RUN apt-get upgrade -y gcc
From the manpage:
-y
,--yes
,--assume-yes
Automatic yes to prompts. Assume "yes" as answer to all prompts and run non-interactively. If an undesirable situation, such as changing a held package or removing an essential package, occurs then apt-get will abort.
Upvotes: 4