2017-04-25 64 views
1

在Docker文件中,我使用wget來下載圖像中的文件。但是,當我在一個碼頭工人,撰寫文件中使用此圖像,容器不包含的文件...Wget在Dockerfile中,文件在容器中消失

FROM debian:8 

    RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/* 

    RUN mkdir -p /blast && cd /blast 
    RUN wget ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/ncbi-blast-2.6.0+-x64-linux.tar.gz 
    RUN tar zxvpf ncbi-blast-2.6.0+-x64-linux.tar.gz && rm ncbi-blast-2.6.0+-x64-linux.tar.gz 
    RUN export PATH=$PATH:/blast/ncbi-blast-2.6.0+/bin 
    #&& export BLASTDB=/blast/blastdb 

    CMD ["sleep", "infinity"] 

在容器我已經在/爆炸文件夾,而不是文件... Someon知道我如何做一個wget並保存文件?爲什麼他們消失了?

編輯

泊塢窗歷史

IMAGE    CREATED    CREATED BY          SIZE    COMMENT 
    13361cc1dda8  9 minutes ago  /bin/sh -C#(nop) CMD ["sleep" "infinity"]  0 B     
    748afb9b0a0a  9 minutes ago  /bin/sh -C#(nop) WORKDIR /blast    0 B     
    6eb2b58af7d4  9 minutes ago  /bin/sh -c export PATH=$PATH:/blast/ncbi-b... 0 B     
    1331a22dcf67  10 minutes ago  /bin/sh -c wget ftp://ftp.ncbi.nlm.nih.gov... 675 MB    
    83d2844843e5  35 minutes ago  /bin/sh -c mkdir -p /blast && cd /blast  0 B     
    6b0b6a13ae47  41 minutes ago  /bin/sh -c apt-get update && apt-get insta... 41.2 MB    
    054abe38b1e6  12 hours ago  /bin/sh -C#(nop) CMD ["/bin/bash"]   0 B     
    <missing>   12 hours ago  /bin/sh -C#(nop) ADD file:712c48086043553... 123 MB   

泊塢窗,撰寫生成的輸出(提取部分)

2017-04-25 07:41:47 (10.1 MB/s) - 'ncbi-blast-2.6.0+-x64-linux.tar.gz' saved [222504398] 

    ncbi-blast-2.6.0+/ 
    ncbi-blast-2.6.0+/ChangeLog 
    ncbi-blast-2.6.0+/LICENSE 
    ncbi-blast-2.6.0+/ncbi_package_info 
    ncbi-blast-2.6.0+/doc/ 
    ncbi-blast-2.6.0+/doc/README.txt 
    ncbi-blast-2.6.0+/bin/ 
    ncbi-blast-2.6.0+/bin/makeblastdb 
    ncbi-blast-2.6.0+/bin/tblastx 
    ncbi-blast-2.6.0+/bin/tblastn 
    ncbi-blast-2.6.0+/bin/blastn 
    ncbi-blast-2.6.0+/bin/blastdb_aliastool 
    ncbi-blast-2.6.0+/bin/update_blastdb.pl 
    ncbi-blast-2.6.0+/bin/windowmasker 
    ncbi-blast-2.6.0+/bin/psiblast 
    ncbi-blast-2.6.0+/bin/blastx 
    ncbi-blast-2.6.0+/bin/rpsblast 
    ncbi-blast-2.6.0+/bin/segmasker 
    ncbi-blast-2.6.0+/bin/blastdbcheck 
    ncbi-blast-2.6.0+/bin/rpstblastn 
    ncbi-blast-2.6.0+/bin/deltablast 
    ncbi-blast-2.6.0+/bin/makembindex 
    ncbi-blast-2.6.0+/bin/convert2blastmask 
    ncbi-blast-2.6.0+/bin/blastp 
    ncbi-blast-2.6.0+/bin/dustmasker 
    ncbi-blast-2.6.0+/bin/makeprofiledb 
    ncbi-blast-2.6.0+/bin/blastdbcmd 
    ncbi-blast-2.6.0+/bin/legacy_blast.pl 
    ncbi-blast-2.6.0+/bin/blast_formatter 
    ncbi-blast-2.6.0+/README 
    ---> 1331a22dcf67 
    Removing intermediate container 06070bb79e70 

回答

1

組跑步,做了wget和一個RUN焦油,類似於

RUN wget ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/ncbi-blast-2.6.0+-x64-linux.tar.gz \ && tar zxvpf ncbi-blast-2.6.0+-x64-linux.tar.gz && rm ncbi-blast-2.6.0+-x64-linux.tar.gz

看到最好的做法寫Dockerfile

https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/

,並在您Dockerfile使用ENV,而不是出口的

https://docs.docker.com/engine/reference/builder/#env

+0

THX,我會做,要遵循最佳pratices,但我文件總是消失:在docker build期間/ – mpiot

+0

你看到tar工作正常嗎?你可以發佈'碼頭歷史your_image'嗎?然後,在tar顯示之後啓動圖層,例如'docker run -it layer_number bash',然後查找您的文件 – user2915097

+0

因此,'docker run -it 1331a22dcf67 bash'並去查找您的文件 – user2915097

相關問題