[GH-ISSUE #971] docker build fails with not a git repository #62511

Closed
opened 2026-05-03 09:18:49 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @j2l on GitHub (Nov 2, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/971

Following the issue https://github.com/jmorganca/ollama/issues/797 I tried to build a local gpu version:

docker build -t ollama/ollama:gpu .
[+] Building 29.0s (17/18)                                                       
 => [internal] load build definition from Dockerfile                        0.0s
 => => transferring dockerfile: 749B                                        0.0s
 => [internal] load .dockerignore                                           0.0s
 => => transferring context: 115B                                           0.0s
 => [internal] load metadata for docker.io/library/ubuntu:22.04             1.6s
 => [internal] load metadata for docker.io/nvidia/cuda:11.8.0-devel-ubuntu  1.0s
 => [auth] library/ubuntu:pull token for registry-1.docker.io               0.0s
 => [auth] nvidia/cuda:pull token for registry-1.docker.io                  0.0s
 => [stage-0 1/7] FROM docker.io/nvidia/cuda:11.8.0-devel-ubuntu22.04@sha2  0.1s
 => => resolve docker.io/nvidia/cuda:11.8.0-devel-ubuntu22.04@sha256:7f34d  0.0s
 => => sha256:9763e3487e02d9fbbd336c7159e713b231d4edb0c3fe 2.63kB / 2.63kB  0.0s
 => => sha256:e53c0e24403e6c7eb47f4e45831f3696ce8b0ce103 18.29kB / 18.29kB  0.0s
 => => sha256:7f34d0a2eeacd94238eaf3827d40636aa0c7c77f5bf6e232 743B / 743B  0.0s
 => https://dl.google.com/go/go1.21.3.linux-amd64.tar.gz                    0.0s
 => [stage-1 1/3] FROM docker.io/library/ubuntu:22.04@sha256:2b7412e6465c  14.8s
 => => resolve docker.io/library/ubuntu:22.04@sha256:2b7412e6465c3c7fc5bb2  0.0s
 => => sha256:2b7412e6465c3c7fc5bb21d3e6f1917c167358449fec 1.13kB / 1.13kB  0.0s
 => => sha256:c9cf959fd83770dfdefd8fb42cfef0761432af36a764c077 424B / 424B  0.0s
 => => sha256:e4c58958181a5925816faa528ce959e487632f4cfd19 2.30kB / 2.30kB  0.0s
 => => sha256:aece8493d3972efa43bfd4ee3cdba659c0f787f8f 29.54MB / 29.54MB  13.9s
 => => extracting sha256:aece8493d3972efa43bfd4ee3cdba659c0f787f8f59c82fb3  0.7s
 => [internal] load build context                                           0.2s
 => => transferring context: 1.23MB                                         0.0s
 => [stage-0 2/7] WORKDIR /go/src/github.com/jmorganca/ollama               0.1s
 => [stage-0 3/7] RUN apt-get update && apt-get install -y git build-esse  17.6s
 => [stage-1 2/3] RUN apt-get update && apt-get install -y ca-certificates  7.8s
 => [stage-0 4/7] ADD https://dl.google.com/go/go1.21.3.linux-amd64.tar.gz  0.3s
 => [stage-0 5/7] RUN mkdir -p /usr/local && tar xz -C /usr/local </tmp/go  2.0s
 => [stage-0 6/7] COPY . .                                                  0.1s
 => ERROR [stage-0 7/7] RUN /usr/local/go/bin/go generate ./...     && /us  7.2s
------
 > [stage-0 7/7] RUN /usr/local/go/bin/go generate ./...     && /usr/local/go/bin/go build .:
#8 0.292 go: downloading github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58
#8 0.295 go: downloading github.com/dustin/go-humanize v1.0.1
#8 0.295 go: downloading github.com/spf13/cobra v1.7.0
#8 0.295 go: downloading github.com/olekukonko/tablewriter v0.0.5
#8 0.295 go: downloading golang.org/x/crypto v0.14.0
#8 0.295 go: downloading golang.org/x/term v0.13.0
#8 0.298 go: downloading github.com/emirpasic/gods v1.18.1
#8 0.303 go: downloading github.com/gin-contrib/cors v1.4.0
#8 0.304 go: downloading github.com/gin-gonic/gin v1.9.1
#8 0.306 go: downloading golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63
#8 0.312 go: downloading golang.org/x/sync v0.3.0
#8 0.327 go: downloading github.com/mattn/go-runewidth v0.0.14
#8 0.789 go: downloading github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db
#8 0.940 go: downloading github.com/rivo/uniseg v0.2.0
#8 0.940 go: downloading golang.org/x/sys v0.13.0
#8 0.940 go: downloading github.com/spf13/pflag v1.0.5
#8 1.227 go: downloading github.com/gin-contrib/sse v0.1.0
#8 1.227 go: downloading github.com/mattn/go-isatty v0.0.19
#8 1.227 go: downloading github.com/ugorji/go/codec v1.2.11
#8 1.227 go: downloading github.com/pelletier/go-toml/v2 v2.0.8
#8 1.227 go: downloading golang.org/x/net v0.17.0
#8 1.227 go: downloading google.golang.org/protobuf v1.30.0
#8 1.228 go: downloading gopkg.in/yaml.v3 v3.0.1
#8 1.228 go: downloading github.com/go-playground/validator/v10 v10.14.0
#8 1.605 go: downloading github.com/gabriel-vasile/mimetype v1.4.2
#8 1.605 go: downloading github.com/go-playground/universal-translator v0.18.1
#8 1.605 go: downloading github.com/leodido/go-urn v1.2.4
#8 1.605 go: downloading golang.org/x/text v0.13.0
#8 2.139 go: downloading github.com/go-playground/locales v0.14.1
#8 7.038 fatal: not a git repository (or any of the parent directories): .git
#8 7.038 llm/llama.cpp/generate_linux.go:3: running "git": exit status 128
------
Dockerfile:14
--------------------
  13 |     ENV GOFLAGS=$GOFLAGS
  14 | >>> RUN /usr/local/go/bin/go generate ./... \
  15 | >>>     && /usr/local/go/bin/go build .
  16 |     
--------------------
error: failed to solve: process "/bin/sh -c /usr/local/go/bin/go generate ./...     && /usr/local/go/bin/go build ." did not complete successfully: exit code: 1
Originally created by @j2l on GitHub (Nov 2, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/971 Following the issue https://github.com/jmorganca/ollama/issues/797 I tried to build a local gpu version: ``` docker build -t ollama/ollama:gpu . [+] Building 29.0s (17/18) => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 749B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 115B 0.0s => [internal] load metadata for docker.io/library/ubuntu:22.04 1.6s => [internal] load metadata for docker.io/nvidia/cuda:11.8.0-devel-ubuntu 1.0s => [auth] library/ubuntu:pull token for registry-1.docker.io 0.0s => [auth] nvidia/cuda:pull token for registry-1.docker.io 0.0s => [stage-0 1/7] FROM docker.io/nvidia/cuda:11.8.0-devel-ubuntu22.04@sha2 0.1s => => resolve docker.io/nvidia/cuda:11.8.0-devel-ubuntu22.04@sha256:7f34d 0.0s => => sha256:9763e3487e02d9fbbd336c7159e713b231d4edb0c3fe 2.63kB / 2.63kB 0.0s => => sha256:e53c0e24403e6c7eb47f4e45831f3696ce8b0ce103 18.29kB / 18.29kB 0.0s => => sha256:7f34d0a2eeacd94238eaf3827d40636aa0c7c77f5bf6e232 743B / 743B 0.0s => https://dl.google.com/go/go1.21.3.linux-amd64.tar.gz 0.0s => [stage-1 1/3] FROM docker.io/library/ubuntu:22.04@sha256:2b7412e6465c 14.8s => => resolve docker.io/library/ubuntu:22.04@sha256:2b7412e6465c3c7fc5bb2 0.0s => => sha256:2b7412e6465c3c7fc5bb21d3e6f1917c167358449fec 1.13kB / 1.13kB 0.0s => => sha256:c9cf959fd83770dfdefd8fb42cfef0761432af36a764c077 424B / 424B 0.0s => => sha256:e4c58958181a5925816faa528ce959e487632f4cfd19 2.30kB / 2.30kB 0.0s => => sha256:aece8493d3972efa43bfd4ee3cdba659c0f787f8f 29.54MB / 29.54MB 13.9s => => extracting sha256:aece8493d3972efa43bfd4ee3cdba659c0f787f8f59c82fb3 0.7s => [internal] load build context 0.2s => => transferring context: 1.23MB 0.0s => [stage-0 2/7] WORKDIR /go/src/github.com/jmorganca/ollama 0.1s => [stage-0 3/7] RUN apt-get update && apt-get install -y git build-esse 17.6s => [stage-1 2/3] RUN apt-get update && apt-get install -y ca-certificates 7.8s => [stage-0 4/7] ADD https://dl.google.com/go/go1.21.3.linux-amd64.tar.gz 0.3s => [stage-0 5/7] RUN mkdir -p /usr/local && tar xz -C /usr/local </tmp/go 2.0s => [stage-0 6/7] COPY . . 0.1s => ERROR [stage-0 7/7] RUN /usr/local/go/bin/go generate ./... && /us 7.2s ------ > [stage-0 7/7] RUN /usr/local/go/bin/go generate ./... && /usr/local/go/bin/go build .: #8 0.292 go: downloading github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 #8 0.295 go: downloading github.com/dustin/go-humanize v1.0.1 #8 0.295 go: downloading github.com/spf13/cobra v1.7.0 #8 0.295 go: downloading github.com/olekukonko/tablewriter v0.0.5 #8 0.295 go: downloading golang.org/x/crypto v0.14.0 #8 0.295 go: downloading golang.org/x/term v0.13.0 #8 0.298 go: downloading github.com/emirpasic/gods v1.18.1 #8 0.303 go: downloading github.com/gin-contrib/cors v1.4.0 #8 0.304 go: downloading github.com/gin-gonic/gin v1.9.1 #8 0.306 go: downloading golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 #8 0.312 go: downloading golang.org/x/sync v0.3.0 #8 0.327 go: downloading github.com/mattn/go-runewidth v0.0.14 #8 0.789 go: downloading github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db #8 0.940 go: downloading github.com/rivo/uniseg v0.2.0 #8 0.940 go: downloading golang.org/x/sys v0.13.0 #8 0.940 go: downloading github.com/spf13/pflag v1.0.5 #8 1.227 go: downloading github.com/gin-contrib/sse v0.1.0 #8 1.227 go: downloading github.com/mattn/go-isatty v0.0.19 #8 1.227 go: downloading github.com/ugorji/go/codec v1.2.11 #8 1.227 go: downloading github.com/pelletier/go-toml/v2 v2.0.8 #8 1.227 go: downloading golang.org/x/net v0.17.0 #8 1.227 go: downloading google.golang.org/protobuf v1.30.0 #8 1.228 go: downloading gopkg.in/yaml.v3 v3.0.1 #8 1.228 go: downloading github.com/go-playground/validator/v10 v10.14.0 #8 1.605 go: downloading github.com/gabriel-vasile/mimetype v1.4.2 #8 1.605 go: downloading github.com/go-playground/universal-translator v0.18.1 #8 1.605 go: downloading github.com/leodido/go-urn v1.2.4 #8 1.605 go: downloading golang.org/x/text v0.13.0 #8 2.139 go: downloading github.com/go-playground/locales v0.14.1 #8 7.038 fatal: not a git repository (or any of the parent directories): .git #8 7.038 llm/llama.cpp/generate_linux.go:3: running "git": exit status 128 ------ Dockerfile:14 -------------------- 13 | ENV GOFLAGS=$GOFLAGS 14 | >>> RUN /usr/local/go/bin/go generate ./... \ 15 | >>> && /usr/local/go/bin/go build . 16 | -------------------- error: failed to solve: process "/bin/sh -c /usr/local/go/bin/go generate ./... && /usr/local/go/bin/go build ." did not complete successfully: exit code: 1 ```
Author
Owner

@BruceMacD commented on GitHub (Nov 2, 2023):

It looks like the hidden .git directory is missing. Did you download the Ollama source code as a zipped package by chance? I don't believe it comes with the git configuration in the case. Try git clone https://github.com/jmorganca/ollama.git to get the source code instead.

<!-- gh-comment-id:1790993278 --> @BruceMacD commented on GitHub (Nov 2, 2023): It looks like the hidden `.git` directory is missing. Did you download the Ollama source code as a zipped package by chance? I don't believe it comes with the git configuration in the case. Try `git clone https://github.com/jmorganca/ollama.git` to get the source code instead.
Author
Owner

@j2l commented on GitHub (Nov 2, 2023):

@BruceMacD you're right, it was missing the .git folder.
Now it builds.
I can't still run it though:

docker-compose up -d
ERROR: The Compose file './docker-compose.yml' is invalid because:
services.llm.deploy.resources.reservations value 'devices' does not match any of the regexes: '^x-'

I think it's related to my nvcc version (11.5). I spoke about it at https://github.com/jmorganca/ollama/issues/797

I close this one as the build issue is fixed
But if there's a way to build and run with 11.5 (default ubuntu 22.04 debian package) please let me know.

<!-- gh-comment-id:1791122836 --> @j2l commented on GitHub (Nov 2, 2023): @BruceMacD you're right, it was missing the .git folder. Now it builds. I can't still run it though: ``` docker-compose up -d ERROR: The Compose file './docker-compose.yml' is invalid because: services.llm.deploy.resources.reservations value 'devices' does not match any of the regexes: '^x-' ``` I think it's related to my nvcc version (11.5). I spoke about it at https://github.com/jmorganca/ollama/issues/797 I close this one as the build issue is fixed But if there's a way to build and run with 11.5 (default ubuntu 22.04 debian package) please let me know.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#62511