How to automatically answer the question of standard input in Dockerfile __docker

Source: Internet
Author: User
Objective

When you use the Docker build to make your own image, you use the Run command to perform some operations to install some of the necessary software.

And some software installation process will require users to enter yes/no or y/n to determine something before entering the next installation.

This can be solved in dockerfile. if it's an occasion to install with Yum,

RUN Yum install-y xxx

The-y parameter can skip the software query, which is equivalent to answering yes. if it's a scenario where the script is installed

For example, we use the SH anaconda3-4.4.0-linux-x86_64.sh to install anaconda, "annoying" Anaconda will ask four questions, my answer order is enter,yes,enter,yes respectively. So you can write this:

RUN sh-c '/bin/echo-e "\nyes\n\nyes" | SH anaconda3-4.4.0-linux-x86_64.sh '

This is a proven trick.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.