docker / buildx

Docker CLI plugin for extended build capabilities with BuildKit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

incorrect client behavior when using a buildx remote driver

sergeimonakhov opened this issue · comments

Contributing guidelines

I've found a bug and checked that ...

  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

hi,

i use remote driver for buildx:

docker buildx create \
  --name remote-kubernetes \
  --driver remote \
  tcp://buildkitd.default.svc:1234 \
  --use

docker buildx build work perfectly:

docker buildx build -t test . --push

but if use docker build:

docker build -t test . --push

i got:

ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

As far as I understand, this is due to docker context:

NAME        DESCRIPTION                               DOCKER ENDPOINT               ERROR
default *   Current DOCKER_HOST based configuration   unix:///var/run/docker.sock

Expected behaviour

Run build on default buildx executor

Actual behaviour

The build is trying to run on the local daemon

Buildx version

github.com/docker/buildx v0.15.1 1c1dbb2

Docker info

Client:
 Version:    26.1.4
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.15.1
    Path:     /usr/local/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.27.2
    Path:     /usr/local/libexec/docker/cli-plugins/docker-compose

Server:
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
errors pretty printing info

Builders list

NAME/NODE                DRIVER/ENDPOINT                                         STATUS    BUILDKIT   PLATFORMS
remote-kubernetes*       remote
 \_ remote-kubernetes0    \_ tcp://buildkitd.default.svc:1234   running   v0.14.1    linux/amd64, linux/amd64/v2, linux/amd64/v3
default                                                                          error

Cannot load builder default: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Configuration

ARG RUST_IMAGE=rust:1.77-slim-bookworm

FROM $RUST_IMAGE as builder

WORKDIR /usr/src/app

COPY . .

RUN apt-get update \
    && apt-get install --no-install-recommends -y pkg-config libssl-dev

RUN cargo build --release

# Stage 2: Create a minimal image with just the binary
FROM debian:bookworm-slim

RUN apt-get update \
    && apt-get install --no-install-recommends -y libssl-dev git ca-certificates \
    && apt-get clean autoclean \
    && apt-get autoremove --yes \
    && rm -rf /var/lib/{apt,dpkg,cache,log}/

# Copy the binary from the previous stage
COPY --from=builder /usr/src/app/target/release/sbc /usr/local/bin/

Build logs

No response

Additional info

No response

i moved this issue to docker/cli#5193