2015-11-08 61 views
1

我想從Dockerfile創建一個關於PyQt5的圖像。 以下是Dockerfile中的部分代碼。如何從Dockerfile創建交互式圖像?

RUN cd PyQt-gpl-5.5.1 &&\ 
     python3 configure.py 
代碼執行時

,它會問我「您是否接受許可協議的條款?」,但我無法輸入任何單詞。

而我不想使用'commit'命令。 那麼如何從Dockerfile創建一個圖像interactive

+1

看看像預期和是的工具。你可能只需要做「yes | python3 configure.py」 –

回答

2

如果殼管不起作用,您可以回退到an expect script

您可以在其中看到安裝預計在its Dockerfile

RUN dpkg --add-architecture i386 && apt-get update && \ 
    apt-get install -y --force-yes expect ... 

一個tools/android-accept-licenses.shvisity/docker-build-android使用一個允許泊塢窗構建TP採用Android 後接受許可第一:

expect { 
    "Do you accept the license '*'*" { 
     exp_send "y\r" 
     exp_continue 
    } 
    eof 
} 

它是用來by the Dockerfile

COPY tools /opt/tools 
ENV PATH ${PATH}:/opt/tools 
RUN ["/opt/tools/android-accept-licenses.sh", "android update sdk --all --no-ui --filter platform-tools,tools,build-tools-22.0.1,android-22,addon-google_apis_x86-google-22,extra-android-support,extra-android-m2repository,extra-google-m2repository,sys-img-armeabi-v7a-android-22"] 

這裏,android-accept-licenses.sh是主機/opt/tools的一部分,它被複制到圖像上,然後在RUN指令中使用。

+0

你可以改進你的解答一步一步解釋如何使用',sh'文件嗎?我的意思是複製/添加等,... – realtebo