Dockerfile 中RUN互動需要輸入 使用者名稱和密碼

愛吃西瓜的二花發表於2020-10-19

首先說問題,在Dockerfile中需要輸入使用者名稱或者密碼
方案一

FROM centos
MAINTAINER woshinaozibulingguang 
RUN yum install -y wget
RUN yum -y install patch make gcc g++
RUN yum -y install ......
#RUN yum -y perl
RUN wget  http://dss.macosforge.org/downloads/DarwinStreamingSrvr6.0.3-Source.tar
RUN tar xvf DarwinStreamingSrvr6.0.3-Source.tar
ENV username woshicainian
ENV password woshinao
ENV password1 woshicainiao
#RUN mv DarwinStreamingSrvr6.0.3-Source DarwinStreamingSrvr6.0.3-Source.orig
COPY dss-6.0.3.patch .
COPY dss-hh-20080728-1.patch .
RUN mv DarwinStreamingSrvr6.0.3-Source DarwinStreamingSrvr6.0.3-Source.orig
RUN patch -p0 < dss-6.0.3.patch
RUN mv DarwinStreamingSrvr6.0.3-Source.orig DarwinStreamingSrvr6.0.3-Source
RUN patch -p0 < dss-hh-20080728-1.patch
RUN groupadd qtss
RUN useradd qtss -g qtss
#RUN cd DarwinStreamingSrvr6.0.3-Source
WORKDIR /DarwinStreamingSrvr6.0.3-Source
RUN ./Buildit
RUN ./buildtarball
RUN tar xzvf DarwinStreamingSrvr-Linux.tar.gz
RUN cd  DarwinStreamingSrvr-Linux
RUN ["./Install"]
#ENTRYPOINT  /usr/local/sbin/DarwinStreamingServer && echo success && while true; do sleep 1;done
ENTRYPOINT /usr/local/sbin/DarwinStreamingServer
CMD /usr/local/sbin/streamingadminserver.pl

方案二
這是在網上的 指令碼案例,不過自己沒有試過

RUN sh -c '/bin/echo -e "\nyes\n\nyes" | sh Anaconda3-4.4.0-Linux-x86_64.sh'

相關文章