Skip to content

Fix: docker-compose builder supports v2.x releases (exec format error) - #713

Open
64johnlee wants to merge 1 commit into
GoogleCloudPlatform:masterfrom
64johnlee:fix/docker-compose-v2-support
Open

64johnlee wants to merge 1 commit into
GoogleCloudPlatform:masterfrom
64johnlee:fix/docker-compose-v2-support

Conversation

@64johnlee

Copy link
Copy Markdown

Summary

Fixes exec format error when using Docker Compose v2.x with the community builder (issue #616).

Root Cause

Docker Compose v2.x changed the release binary naming convention on GitHub:

Version Binary name
v1.x docker-compose-Linux-x86_64 (OS capitalized)
v2.x docker-compose-linux-x86_64 (OS lowercase)

The Dockerfile used $(uname -s) which returns Linux (capital L). For v2.x releases this produces a 404 URL. Because curl was called without --fail, it silently wrote the HTTP error page to disk. After chmod +x succeeded, trying to execute the HTML file produces:

exec /usr/local/bin/docker-compose: exec format error

Fix

Dockerfile:

  • Pipe uname -s through tr '[:upper:]' '[:lower:]' to produce the lowercase OS name needed by v2.x
  • Add --fail to curl so HTTP errors (404) abort the build immediately instead of producing a silently broken binary
  • Update base image from ubuntu:bionic (EOL April 2023) to ubuntu:focal (LTS, supported until April 2025)

cloudbuild.yaml:

  • Update default _DOCKER_COMPOSE_VERSION from 1.28.2 to 2.29.7 (current stable v2 release)

Backward Compatibility

  • Users passing an explicit --substitutions _DOCKER_COMPOSE_VERSION=X.Y.Z will also need to use v2.x format versions
  • v1.x is EOL (end of life since July 2023); migration to v2 is the official path
  • The v prefix added to the release tag URL works for all Docker Compose releases (both v1.x and v2.x tags on GitHub include the v prefix)

Example

# Build with Docker Compose v2.29.7 (default)
steps:
- name: 'gcr.io/$PROJECT_ID/docker-compose'
  args: ['up', '-d']

# Or specify a version explicitly
# gcloud builds submit . --substitutions _DOCKER_COMPOSE_VERSION=2.25.0

🤖 Generated with Claude Code

Docker Compose v2.x changed the release binary naming convention:
- v1.x: docker-compose-Linux-x86_64  (OS capitalized, from uname -s)
- v2.x: docker-compose-linux-x86_64  (OS lowercase)

The old Dockerfile used $(uname -s) which returns "Linux" (capital L).
For v2.x releases this produces a 404 URL. curl would silently save the
HTTP error page to disk, chmod would succeed, and execution would fail
with "exec format error" — the symptom reported in issue GoogleCloudPlatform#616.

Fix: pipe uname -s through tr to lowercase the OS name.
Also adds --fail to curl so HTTP errors abort the build immediately
rather than producing a silently broken binary.

Additional: update base image from ubuntu:bionic (EOL Apr 2023) to
ubuntu:focal (LTS until Apr 2025), and update default version in
cloudbuild.yaml from 1.28.2 to 2.29.7.

Fixes GoogleCloudPlatform#616

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@google-cla

google-cla Bot commented Jun 6, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant