'what is '-y' in RUN apk -update -y

what is '-y' in RUN APK -update -y Can we use the command without -y

I am using RUN apk update && apk upgrade in my code

Can I use the command without a -y



Solution 1:[1]

Yes!

RUN Command is used when you use Dockerfile to execute a command inside the particular container.

what is '-y' in RUN apk -update -y

Well -y as @kristian said is not found in apk man page, to be precise in alpine. Maybe it was apt update -y or apk update as apt comes in all Debian based flavors.

From the results of running man apt-get

-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, trying to install a unauthenticated
           package or removing an essential package occurs then apt-get will
           abort. Configuration Item: APT::Get::Assume-Yes.  

Can I use the command without a -y

Yes! If you run commands without the -y option, you need to answer to all prompts that you get from that command interactively in order for the execution of the command to continue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Amogh Saxena - REXTER