Skip to content

Example "docker compose --build" Fails on Mac #453

@mottati

Description

@mottati

Cloning this repository and immediately attempting a "docker compose up --build" fails on a Mac. I dont have other OS versions to test this on but it definitly fails on a Mac.

The terminal output below demonstrates the problem.

MacBook-Pro:docsy-example $ git clone https://github.com/google/docsy-example bug-report
Cloning into 'bug-report'...
remote: Enumerating objects: 2372, done.
remote: Counting objects: 100% (160/160), done.
remote: Compressing objects: 100% (63/63), done.
remote: Total 2372 (delta 132), reused 97 (delta 97), pack-reused 2212 (from 3)
Receiving objects: 100% (2372/2372), 2.80 MiB | 5.09 MiB/s, done.
Resolving deltas: 100% (1290/1290), done.
MacBook-Pro:docsy-example $ cd bug-report/
MacBook-Pro:bug-report $ docker compose up --build 
WARN[0000] /Users/michael.ottati/Docker/docsy-example/bug-report/docker-compose.yaml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
[+] Building 0.9s (6/6) FINISHED                                                                                                                                                  docker:desktop-linux
 => [site internal] load build definition from Dockerfile                                                                                                                                         0.0s
 => => transferring dockerfile: 137B                                                                                                                                                              0.0s
 => [site internal] load metadata for docker.io/floryn90/hugo:ext-alpine                                                                                                                          0.7s
 => [site auth] floryn90/hugo:pull token for registry-1.docker.io                                                                                                                                 0.0s
 => [site internal] load .dockerignore                                                                                                                                                            0.0s
 => => transferring context: 2B                                                                                                                                                                   0.0s
 => CACHED [site 1/2] FROM docker.io/floryn90/hugo:ext-alpine@sha256:47e849b45a737336dbeb78bbc216825e79626d0fc18f7843d506a2a74540df34                                                             0.0s
 => ERROR [site 2/2] RUN apk add git &&   git config --global --add safe.directory /src                                                                                                           0.1s
------                                                                                                                                                                                                 
 > [site 2/2] RUN apk add git &&   git config --global --add safe.directory /src:
0.122 ERROR: Unable to open log: Permission denied
------
failed to solve: process "/bin/sh -c apk add git &&   git config --global --add safe.directory /src" did not complete successfully: exit code: 99
MacBook-Pro:bug-report $ MacBook

I was able to work around this issue by eliminating the Dockerfile and using a hugomods/hugo container that worked (for me). Not sure why someones custom hugo container is being used, or why the build is not working. Was able to get past this problem with the following simple change to the docker-compose.yml file.

MacBook-Pro:bugreport $ git diff  -U0 
diff --git a/Dockerfile b/Dockerfile
index 232d8f7..7f3fa59 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1 +1 @@
-FROM floryn90/hugo:ext-alpine
+FROM hugomods/hugo:debian-exts-non-root-0.154.5
diff --git a/docker-compose.yaml b/docker-compose.yaml
index e75500c..24b81d0 100644
--- a/docker-compose.yaml
+++ b/docker-compose.yaml
@@ -5,3 +5 @@ services:
-    image: docsy/docsy-example
-    build:
-      context: .
+    image: hugomods/hugo:debian-exts-non-root-0.154.5
MacBook-Pro:bugreport $ 

Not sure if that container contains all of the dependencys required for the docsy-example. It does contain git and the container comes up. I am not certain why the original Dockerfile needed the git safe.directory command. My simple solution omits that step due to the removal of the build portion all together.

Here is the result docker compose up against my modified copy.

MacBook-Pro:bugreport michael.ottati$ docker compose up 
WARN[0000] /Users/michael.ottati/Docker/docsy-example/bugreport/docker-compose.yaml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
[+] Running 2/2
 ✔ Network bugreport_default   Created                                                                                                                                                            0.1s 
 ✔ Container bugreport-site-1  Created                                                                                                                                                            0.0s 
Attaching to site-1
site-1  | hugo: downloading modules …
site-1  | hugo: collected modules in 11896 msWARN  Module "github.com/google/docsy-example" is not compatible with this Hugo version: Min 0.157.0 extended; run "hugo mod graph" for more information.
site-1  | Watching for changes in /src/assets/scss, /src/content/en/{about,blog,community,docs}, /src/content/fa/{about,blog,community,docs}, /src/content/no/docs, /src/layouts/_markup, /src/package.json, /tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/google/docsy@v0.15.0/assets/{_cache,_vendor,icons,js,json,...}, /tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/google/docsy@v0.15.0/i18n, /tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/google/docsy@v0.15.0/layouts/{_markup,_partials,_shortcodes,blog,community,...}, /tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/google/docsy@v0.15.0/package.json, ... and 2 more
site-1  | Watching for config changes in /src/hugo.yaml, /tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/google/docsy@v0.15.0/hugo.yaml, /src/go.mod
site-1  | Start building sites … 
site-1  | hugo v0.154.5-a6f99cca223a29cad1d4cdaa6a1a90508ac1da71+extended linux/arm64 BuildDate=2026-01-11T20:53:23Z VendorInfo=hugomods
site-1  | 
site-1  | 
site-1  |                  │ EN │ FA │ NO 
site-1  | ─────────────────┼────┼────┼────
site-1  |  Pages           │ 71 │ 30 │ 97 
site-1  |  Paginator pages │  0 │  0 │  0 
site-1  |  Non-page files  │  3 │  0 │  0 
site-1  |  Static files    │ 30 │ 30 │ 30 
site-1  |  Processed       │  6 │  0 │  0 
site-1  |  images          │    │    │    
site-1  |  Aliases         │  5 │  4 │  0 
site-1  |  Cleaned         │  0 │  0 │  0 
site-1  | 
site-1  | Built in 1357 ms
site-1  | Environment: "development"
site-1  | Serving pages from disk
site-1  | Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
site-1  | Web Server is available at http://localhost:1313/ (bind address 0.0.0.0) 
site-1  | Press Ctrl+C to stop
Gracefully stopping... (press Ctrl+C again to force)
[+] Stopping 1/1
 ✔ Container bugreport-site-1  Stopped                                                                                                                                                            0.3s 
MacBook-Pro:bugreport michael.ottati$ docker compose down 
WARN[0000] /Users/michael.ottati/Docker/docsy-example/bugreport/docker-compose.yaml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
[+] Running 2/2
 ✔ Container bugreport-site-1  Removed                                                                                                                                                            0.1s 
 ✔ Network bugreport_default   Removed                                                                                                                                                            0.3s 
MacBook-Pro:bugreport michael.ottati$

Finally, it would be cleaner to remove the version attribute from the docker-compose.yml file to eliminate the warning message it causes.

docker-compose.yaml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions