Docker command fails during build, but succeeds while executed within running container

前端 未结 3 1127
小鲜肉
小鲜肉 2020-12-03 04:46

the command :

docker build -t nginx-ubuntu . 

whith the Dockerfile below :

FROM ubuntu:12.10
RUN apt-get update
RUN apt-get -y         


        
3条回答
  •  萌比男神i
    2020-12-03 05:38

    The pwd is not persistent across RUN commands. You need to cd and configure within the same RUN.

    This Dockerfile works fine:

    FROM ubuntu:12.10
    RUN apt-get update
    RUN apt-get -y install libpcre3 libssl-dev
    RUN apt-get -y install libpcre3-dev
    RUN apt-get -y install wget zip gcc
    RUN wget http://nginx.org/download/nginx-1.4.1.tar.gz
    RUN gunzip nginx-1.4.1.tar.gz
    RUN tar -xf nginx-1.4.1.tar
    RUN wget --no-check-certificate https://github.com/max-l/nginx_accept_language_module/archive/master.zip
    RUN unzip master
    RUN cd nginx-1.4.1 && ./configure --add-module=../nginx_accept_language_module-master --with-http_ssl_module --with-pcre=/lib/x86_64-linux-gnu --with-openssl=/usr/lib/x86_64-linux-gnu
    

提交回复
热议问题