I'm trying to do a container with some tools, one of those is git.
I need git 1.8.4.2 and I downloaded the tarball from here
https://github.com/git/git/archive/v1.8.4.2.tar.gz
First tried to do all the setup in a vanilla centos:7 container to do the test and it worked very well.
The problem is when I build the container with the commands, it installs git 1.8.4.1. This version may be work with the things that I will do, but I'm very curious why this happens if I'm using the same tarball and same commands.
Here is my Dockerfile
FROM centos:7
## Installing git 1.8.4.2
RUN yum -y install gcc make
RUN yum -y install wget zlib-devel openssl-devel cpio expat-devel gettext-devel curl-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
RUN wget -O v1.8.4.2.tar.gz https://github.com/git/git/archive/v1.8.4.2.tar.gz
RUN tar -xzvf ./v1.8.4.2.tar.gz
RUN cd git-1.8.4.2/ \
make prefix=/usr/local all \
make prefix=/usr/local install
Output when I build the container
[root@adbc2f7ab54f git-1.8.4.2]# git --version
git version 1.8.3.1
Output when I do it manually
root@adbc2f7ab54f git-1.8.4.2]# git --version
git version 1.8.4.2
CodePudding user response:
The last three lines of your Dockerfile
are specifying a single command:
cd git-1.8.4.2/ make prefix=/usr/local all make prefix=/usr/local install
...which doesn't work. As a result git 1.8.4.2 is not being compiled, it's not being installed, and the version of git in the container is the one that comes with CentOS 7 (1.8.3.1).
You need to add &&
between the three commands:
RUN cd git-1.8.4.2/ \
&& make prefix=/usr/local all \
&& make prefix=/usr/local install