# syntax=docker/dockerfile:1
ARG GO_VERSION=1.26.3
ARG BUILD_TAGS="e2e"
FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION}-alpine3.23 AS base
# Install build dependencies
RUN apk add --no-cache \
clang \
docker \
file \
findutils \
git \
make \
protoc \
protobuf-dev
WORKDIR /src
ENV CGO_ENABLED=0
# Cache Go modules
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
go mod download
# Copy source
COPY . .
# Build the project
RUN --mount=type=bind,target=. \
--mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/go/pkg/mod \
GO_BUILDTAGS="$BUILD_TAGS" DESTDIR=/out make build
# Final: minimal image with produced docker-compose binary
FROM scratch AS binary-unix
COPY --from=base /out/docker-compose /docker-compose
FROM scratch AS release
COPY --from=binary-unix /docker-compose /docker-compose
ENTRYPOINT ["/docker-compose"]
# syntax=docker/dockerfile:1
FROM golang:tip-alpine3.23 AS build
# Install required build dependencies
RUN apk add --no-cache \
clang \
docker \
file \
findutils \
git \
make \
protoc \
protobuf-dev
WORKDIR /src
ENV CGO_ENABLED=0
# Cache Go modules
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
go mod download
# Copy source and build
COPY . .
RUN --mount=type=bind,target=. \
--mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/go/pkg/mod \
go build -trimpath -ldflags "-w -X github.com/docker/compose/v5/internal.Version=dev" -o /out/docker-compose ./cmd
FROM scratch AS release
COPY --from=build /out/docker-compose /docker-compose
ENTRYPOINT ["/docker-compose"]
Build timed out after 600s
# syntax=docker/dockerfile:1
ARG GO_VERSION=1.26.3
# Build stage: compile the docker-compose binary for linux/amd64
FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION}-alpine3.23 AS build
# Install required build dependencies
RUN apk add --no-cache \
clang \
docker \
file \
findutils \
git \
make \
protoc \
protobuf-dev
WORKDIR /src
ENV CGO_ENABLED=0
# Cache Go modules
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
true
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go mod download
# Copy source and build
COPY . .
RUN --mount=type=bind,target=. \
VERSION=$(git describe --tags --dirty --always 2>/dev/null || echo "dev") && \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -trimpath -ldflags "-X github.com/docker/compose/v5/internal.Version=${VERSION}" -o /out/docker-compose ./cmd
FROM scratch AS release
COPY --from=build /out/docker-compose /docker-compose
ENTRYPOINT ["/docker-compose"]
# syntax=docker/dockerfile:1
ARG BUILD_TAGS="e2e"
# Build stage: compile the docker-compose binary for linux/amd64
FROM golang:1.26.3-alpine3.23 AS build
# Install required build dependencies
RUN apk add --no-cache \
clang \
docker \
file \
findutils \
git \
make \
protoc \
protobuf-dev
WORKDIR /src
ENV CGO_ENABLED=0
# Cache Go modules (first layer)
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
true
RUN go mod download
# Copy source and build
COPY . .
RUN --mount=type=bind,target=. \
make build GO_BUILDTAGS="$BUILD_TAGS" DESTDIR=/out
# Final: minimal image with produced docker-compose binary
FROM scratch AS binary
COPY --from=build /out/docker-compose /docker-compose
ENTRYPOINT ["/docker-compose"]
Build timed out after 600s
# syntax=docker/dockerfile:1
ARG GO_VERSION=1.26.3
ARG BUILD_TAGS="e2e"
# Build stage: compile the docker-compose binary for linux/amd64
FROM golang:${GO_VERSION}-alpine3.23 AS build
# Install required build dependencies
RUN apk add --no-cache \
clang \
docker \
file \
findutils \
git \
make \
protoc \
protobuf-dev
WORKDIR /src
ENV CGO_ENABLED=0
# Cache Go modules (first layer)
COPY go.mod go.sum ./
RUN --no-cache go mod download
# Copy source and build
COPY . .
RUN make build GO_BUILDTAGS="$BUILD_TAGS" DESTDIR=/out
FROM scratch AS release
COPY --from=build /out/docker-compose /docker-compose
ENTRYPOINT ["/docker-compose"]
# syntax=docker/dockerfile:1
FROM golang:1.26.3-alpine3.23 AS build
# Install required build dependencies
RUN apk add --no-cache \
clang \
docker \
file \
findutils \
git \
make \
protoc \
protobuf-dev
WORKDIR /src
ENV CGO_ENABLED=0
# Cache Go modules (download dependencies)
COPY go.mod go.sum ./
RUN go mod download
# Copy source and build
COPY . .
RUN make build DESTDIR=/out
FROM scratch AS release
COPY --from=build /out/docker-compose /docker-compose
ENTRYPOINT ["/docker-compose"]
Build timed out after 600s
# syntax=docker/dockerfile:1
ARG GO_VERSION=1.26.3
ARG BUILD_TAGS="e2e"
# Build stage: compile the docker-compose binary for linux/amd64
FROM golang:tip-alpine3.23 AS build
# Install required build dependencies
RUN apk add --no-cache \
clang \
docker \
file \
findutils \
git \
make \
protoc \
protobuf-dev
WORKDIR /src
ENV CGO_ENABLED=0
# Cache Go modules and download dependencies
COPY go.mod go.sum ./
RUN go mod download
# Copy source and build
COPY . .
RUN GO_BUILDTAGS="$BUILD_TAGS" DESTDIR=/out make build
# Final: minimal image with produced docker-compose binary
FROM scratch AS release
COPY --from=build /out/docker-compose /docker-compose
ENTRYPOINT ["/docker-compose"]
Build timed out after 600s
# syntax=docker/dockerfile:1
FROM golang:tip-alpine3.23 AS build
# Install required build dependencies
RUN apk add --no-cache \
clang \
docker \
file \
findutils \
git \
make \
protoc \
protobuf-dev
WORKDIR /src
ENV CGO_ENABLED=0
# Cache modules
COPY go.mod go.sum ./
RUN go mod download
# Copy source and build linux/amd64 binary
COPY . .
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
go build -trimpath -o /out/docker-compose ./cmd
FROM scratch AS release
COPY --from=build /out/docker-compose /docker-compose
ENTRYPOINT ["/docker-compose"]
Build timed out after 600s
# syntax=docker/dockerfile:1
FROM golang:1.26.3-alpine3.23 AS build
# Install minimal build dependencies
RUN apk add --no-cache \
git \
make
WORKDIR /src
ENV CGO_ENABLED=0
# Cache Go modules and download dependencies
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
true
RUN go mod download
# Copy source and build
COPY . .
RUN make build DESTDIR=/out GO_BUILDTAGS="e2e"
FROM scratch AS release
COPY --from=build /out/docker-compose /docker-compose
ENTRYPOINT ["/docker-compose"]
Build timed out after 600s
# syntax=docker/dockerfile:1
FROM golang:1.26.3-alpine3.23 AS build
# Install minimal build dependencies
RUN apk add --no-cache git make
WORKDIR /src
ENV CGO_ENABLED=0
# Cache modules and download dependencies
COPY go.mod go.sum ./
RUN go mod download
# Copy source and build a linux/amd64 binary
COPY . .
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
go build -trimpath -o /out/docker-compose ./cmd
FROM scratch AS release
COPY --from=build /out/docker-compose /docker-compose
ENTRYPOINT ["/docker-compose"]
Build timed out after 600s
# syntax=docker/dockerfile:1
FROM golang:1.26.3-alpine3.23 AS build
# Install minimal build dependencies
RUN apk add --no-cache git make
WORKDIR /src
# Cache Go modules and download dependencies
COPY go.mod go.sum ./
RUN go mod download
# Copy source and build linux/amd64 binary
COPY . .
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
make build DESTDIR=/out
# Final minimal runtime image containing the docker-compose binary
FROM scratch AS release
COPY --from=build /out/docker-compose /docker-compose
ENTRYPOINT ["/docker-compose"]
Build timed out after 600s
# syntax=docker/dockerfile:1
ARG GO_VERSION=1.26.3
FROM golang:${GO_VERSION}-alpine3.23 AS build
WORKDIR /src
RUN apk add --no-cache git make
ENV CGO_ENABLED=0
# Cache modules and download dependencies
COPY go.mod go.sum ./
RUN go mod download
# Copy all sources and build
COPY . .
RUN make build DESTDIR=/out
FROM scratch AS release
COPY --from=build /out/docker-compose /docker-compose
ENTRYPOINT ["/docker-compose"]
# syntax=docker/dockerfile:1
FROM golang:1.26.3-alpine3.23 AS build
# Install required build dependencies
RUN apk add --no-cache \
clang \
docker \
file \
findutils \
git \
make \
protoc \
protobuf-dev
WORKDIR /src
ENV CGO_ENABLED=0
# Cache Go modules and download dependencies
COPY go.mod go.sum ./
RUN go mod download
# Copy source and build linux/amd64 binary
COPY . .
RUN --mount=type=bind,target=. \
VERSION=$(git describe --tags --dirty --always 2>/dev/null || echo dev) && \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-X github.com/docker/compose/v5/internal.Version=${VERSION}" -o /out/docker-compose ./cmd
FROM scratch AS release
COPY --from=build /out/docker-compose /docker-compose
ENTRYPOINT ["/docker-compose"]
Error summary:
- Cause: Insufficient disk space during the final Go build step. The log shows repeated “no space left on device” errors in /tmp/go-build and during writing the build output.
- Exit code: 1
Failing command/step:
- The final RUN in the Dockerfile (build step 7/7):
RUN --mount=type=bind,target=. VERSION=$(git describe --tags --dirty --always 2>/dev/null || echo dev) && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-X github.com/docker/compose/v5/internal.Version=${VERSION}" -o /out/docker-compose ./cmd
Exact error messages and exit code:
- compile: writing output: write $WORK/b202/_pkg_.a: no space left on device
- ... (multiple mkdir /tmp/go-build...: no space left on device)
- ERROR: process "/bin/sh -c VERSION=$(git describe --tags --dirty --always 2>/dev/null || echo dev) && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags \"-X github.com/docker/compose/v5/internal.Version=${VERSION}\" -o /out/docker-compose ./cmd" did not complete successfully: exit code: 1
Missing packages or files mentioned:
- None explicitly missing. The failure is due to no space left on device during build, not missing dependencies or files.
Version mismatch / environment info:
- Base image: golang:1.26.3-alpine3.23
- Build target: linux/amd64 with CGO_ENABLED=0
- Version reference in build: VERSION derived from git describe --tags --dirty --always (fallback to "dev")
- No explicit version mismatch reported in logs; the failure is disk-space related, not a version conflict.# syntax=docker/dockerfile:1 FROM golang:1.26.3-alpine3.23 AS build # Install minimal build dependencies RUN apk add --no-cache git make WORKDIR /src ENV CGO_ENABLED=0 # Cache modules and download dependencies COPY go.mod go.sum ./ RUN go mod download # Copy all sources and build the linux/amd64 binary COPY . . RUN make build DESTDIR=/out FROM scratch AS release COPY --from=build /out/docker-compose /docker-compose ENTRYPOINT ["/docker-compose"]
Build timed out after 600s
# syntax=docker/dockerfile:1
ARG GO_VERSION=1.26.3
FROM golang:${GO_VERSION}-alpine3.23 AS build
# Install minimal build dependencies
RUN apk add --no-cache git make
WORKDIR /src
ENV CGO_ENABLED=0
# Cache Go modules and download dependencies
COPY go.mod go.sum ./
RUN go mod download
# Copy all sources and build the linux/amd64 binary via the Makefile
COPY . .
RUN make build DESTDIR=/out
# Final minimal runtime image containing the docker-compose binary
FROM scratch AS release
COPY --from=build /out/bin/build/docker-compose /docker-compose
ENTRYPOINT ["/docker-compose"]
# syntax=docker/dockerfile:1
# Lightweight builder for Docker Compose CLI (v5) from source
# Build from Go sources using the repository's Makefile and DESTDIR to /out
# Final runtime image is scratch with the static docker-compose binary copied in.
FROM golang:1.26.3-alpine3.23 AS builder
# Install essential build tooling
RUN apk add --no-cache git make
WORKDIR /src
# Pre-copy go.mod files to leverage cache
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
# Copy the rest of the source
COPY . ./
# Build a static binary using the project's Makefile
ENV CGO_ENABLED=0
RUN make build DESTDIR=/out
FROM scratch AS release
# Copy the static binary into the final image
COPY --from=builder /out/docker-compose /docker-compose
# Default entrypoint to show version/help when run without args
ENTRYPOINT ["/docker-compose"]
CMD ["version"]