+ untar httpd-2.4.37.tar.gz and run ./confiure in docker

+i am trying untar  httpd-2.4.37.tar.gz and run ./confiure --prefix=/app/apache2.4 --with-included-apr, but it fails at 
Step 19/21 : RUN ./configure --prefix=/app/apache2.4 --with-included-apr
---> Running in 8f64d90da6fa
/bin/sh: ./configure: No such file or directory
The command '/bin/sh -c ./configure --prefix=/app/apache2.4 --with-included-apr' returned a non-zero code: 127
apache_build $

below is docker build file
#This is custom apache image with ssh already installed
2 FROM centos:latest
3 Maintainer ec2-user <jithendra@mayapu.com>
4 RUN yum -y update
5 RUN yum install -y telnet openssh-server wget
6 EXPOSE 80
7 RUN mkdir -p /app/apache2.4
8 RUN useradd webadmin
9 RUN mkdir /home/webadmin/software
10 CMD cd /home/webadmin/software
11 RUN wget http://apache.mirrors.hoobly.com//httpd/httpd-2.4.37.tar.gz
12 RUN tar -xzvf httpd-2.4.37.tar.gz
13 RUN yum install pcre-devel -y; export PATH=/usr/bin/gcc:$PATH ; yum install expat-devel ; yum -y install glibc-static libstdc++-static
14 #RUN mkdir -p /home/webadmin/software/httpd-2.4.37/srclib
15 CMD cd /home/webadmin/software/httpd-2.4.37/srclib
16 RUN wget http://mirrors.sorengard.com/apache//apr/apr-1.6.5.tar.gz ; wget http://mirrors.sorengard.com/apache//apr/apr-util-1.6.1.tar.gz
17 RUN tar -xzvf apr-1.6.5.tar.gz ; tar -xzvf apr-util-1.6.1.tar.gz
18 RUN mv apr-1.6.5 apr ; mv apr-util-1.6.1 apr-util
19 CMD cd /home/webadmin/software/httpd-2.4.37
20 RUN ls -ltr /home/webadmin/software/
21 RUN ./configure --prefix=/app/apache2.4 --with-included-apr
22 RUN make
23 RUN make install

  • post-author-pic
    James M
    12-12-2018

    Your RUN command is executing in the shell form


    /bin/sh -c <command>
     This results in you losing your current directory because the next command will be exectuted in essentially a new container.

    The easy work around is to include the environment changes needed within each RUN command like this.

    RUN cd /home/webadmin/software/httpd-2.4.37 && ./configure --prefix=/app/apache2.4 --with-included-apr

Looking For Team Training?

Learn More