Skip to content

[BUG] Building with Bake fails if using context with TLS endpoint #13015

@GethDeeo

Description

@GethDeeo

Description

I'm using Docker context with TLS endpoint.
When building with Compose (Bake enabled), I get this error:
ERROR: Error response from daemon: Client sent an HTTP request to an HTTPS server.

I would put my 2 cents on PR #12961's commit:
It explicitly sets the DOCKER_HOST environment variable from the CLI, always pointing to the context's endpoint.
DOCKER_HOST has a higher precedence than DOCKER_CONTEXT (which is also copied from the CLI).
Without proper TLS configuration (missing DOCKER_CERT_PATH and DOCKER_TLS*), Bake will try to connect to the endpoint without TLS, hence the error.

Steps To Reproduce

  1. Configure a TLS endpoint as Docker server by using Docker context.
  2. Try to build something with Compose (Bake enabled).

Compose Version

Docker Compose version v2.38.1

Docker Environment

Client: Docker Engine - Community
 Version:    28.3.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.25.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.38.1
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 8
  Running: 8
  Paused: 0
  Stopped: 0
 Images: 8
 Server Version: 28.3.1
 Storage Driver: overlayfs
  driver-type: io.containerd.snapshotter.v1
 Logging Driver: local
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 05044ec0a9a75232cad458027ca83437aae3f4da
 runc version: v1.2.5-0-g59923ef
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
  no-new-privileges
 Kernel Version: 6.8.0-63-generic
 Operating System: Ubuntu 24.04.2 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 7.755GiB
 Name: ftr-ci
 ID: fbd01284-1938-4523-a5fb-442499c459bd
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false
 Default Address Pools:
   Base: 172.25.0.0/16, Size: 24

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions