./configure not found in Docker build


March 2019


19 time


I am trying to build swig inside of a Dockerfile. However, when I try to run ./configure, I get an error saying it is not found, although it is definitely there.

Here is a working sample for swig installation using Dockerfile:

FROM nvidia/cuda:7.5-cudnn4-devel
MAINTAINER Tim O'Shea <[email protected]>
# install swig
RUN apt-get install -y g++
RUN apt-get install -y libpcre3 libpcre3-dev
RUN wget "http://prdownloads.sourceforge.net/swig/swig-3.0.12.tar.gz"
RUN chmod 777 swig-3.0.12.tar.gz
RUN tar -xzvf swig-3.0.12.tar.gz
RUN cd swig-3.0.12 && chmod +x ./configure && ls -l
RUN ./configure --prefix=$(pwd)/swigtool
RUN make
RUN make install

1 answers


The issue in these lines in specific:

RUN cd swig-3.0.12 && chmod +x ./configure && ls -l
RUN ./configure --prefix=$(pwd)/swigtool

Note that RUN works per layer only which means each time you have to use RUN cd swig-3.0.12 so you may add them to one layer like this

RUN cd swig-3.0.12 && /configure --prefix="$PWD/swigtool" && make && make install

The RUN instruction will execute any commands in a new layer on top of the current image and commit the results which explained in RUN in Dockerfile.

Alternatively you can add this before all commands that needs to be executed inside swig-3.0.12 directory, for example:

WORKDIR /swig-3.0.12
RUN ./configure --prefix="$PWD/swigtool"
RUN make
RUN make install