Docker-compose - failed to init repo at /var/lib/docker/tmp/docker-build-git290746704: : exec: "git": executable file not found in $PATH

Im encountering the below error when exceuting docker-compose build with git repo

  1. docker build works perfectly fine. Issue occurs only in docker-compose.
  2. i have verified the $PATH pointing to git binaries
  3. i’m able to execute git cli commands

The issue only occurs with the docker-compose build. Please help

docker-compose -f ./compose/A.yml -f ./compose/B.yml up -d --build service

failed to init repo at /var/lib/docker/tmp/docker-build-git290746704: : exec: “git”: executable file not found in $PATH

  • docker-compose version
    docker-compose version 1.22.0, build f46880fe
    docker-py version: 3.4.1
    CPython version: 3.6.6
    OpenSSL version: OpenSSL 1.1.0f 25 May 2017
    [Pipeline] echo

[Pipeline] sh
[unitTestJenkins] Running shell script

  • docker version
    Client:
    Version: 18.06.3-ce
    API version: 1.38
    Go version: go1.10.3
    Git commit: d7080c1
    Built: Wed Feb 20 02:26:51 2019
    OS/Arch: linux/amd64
    Experimental: false

Server:
Engine:
Version: 18.06.3-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: d7080c1
Built: Wed Feb 20 02:28:17 2019
OS/Arch: linux/amd64
Experimental: false

git --version
git version 2.22.0