3

I'm using docker to install my dependencies. Using Node:10.13.0 as

FROM: node:10.13.0

All dependencies installed well except Husky.

And it shows the following:

Husky requires Git >=2.13.0. Got v2.11.0.   
husky > Failed to install

So, the problem is that the git version is below 2.13.

Searched for init git version in the docker file. But I don't get any solution.

Is any other way to set the git version in the docker file?.

Surya S
  • 53
  • 8
  • 1
    What distro is that `node:10.13.0` derivation based on? (Find _its own_ Dockerfile, and look at the `FROM:` line). Use whatever package manager its upstream provides -- if it's `FROM ubuntu`, then `apt`; if it's `FROM alpine`, then `apk`; etc. – Charles Duffy Dec 22 '20 at 16:38

1 Answers1

3
  • Next means node:10.13.0 use debian9, aka stretch.

    $ docker run --rm node:10.13.0 cat /etc/issue
    Debian GNU/Linux 9 \n \l
    
  • Next means node:10.13.0 default use git 2.11.

    $ docker run --rm node:10.13.0 git --version
    git version 2.11.0
    

In fact, git in debian 9 apt repo use the version 2.11, if you want to upgrade to a newer version, you could use debian backports, which means:

Backports are packages taken from the next Debian release

By default, backports won't be used when use apt. You could use next sample to enable this.

Dockerfile:

FROM node:10.13.0
RUN echo "deb http://deb.debian.org/debian stretch-backports main contrib non-free" >> /etc/apt/sources.list; \
    apt-get update; \
    apt-get -t stretch-backports install git -y

Verify it:

$ docker build -t mynodeimage .
Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM node:10.13.0
......
Successfully tagged mynodeimage:latest
$ docker run --rm mynodeimage git --version
git version 2.20.1
atline
  • 28,355
  • 16
  • 77
  • 113
  • Getting `Failed to fetch http://deb.debian.org/debian/dists/stretch/InRelease Could not connect to debian.map.fastlydns.net:80 (151.101.154.132)`. And Is there a way for **ubuntu** distribution? – Surya S Dec 23 '20 at 06:00
  • Do you behind a proxy? What does `I used ubuntu distribution` mean? You mean your host is ubuntu? – atline Dec 23 '20 at 06:01
  • No, not behind proxy. Debian and ubuntu are two of the Linux distribution right? – Surya S Dec 23 '20 at 06:04
  • What's the output of `docker run --rm node:10.13.0 ping debian.map.fastlydns.net -c 4`? And your base image is debian, why you mention ubuntu to me? – atline Dec 23 '20 at 06:09
  • Sorry for the mistake, I'm totally new to using docker. And now it's getting latest git version. – Surya S Dec 23 '20 at 06:18
  • why this message is shown while build `debconf: delaying package configuration, since apt-utils is not installed`. – Surya S Dec 23 '20 at 07:19
  • @SuryaS See [this](https://stackoverflow.com/questions/51023312/docker-having-issues-installing-apt-utils) – atline Dec 23 '20 at 07:22