docker / docker/cli

incorrect docker client behavior when using a buildx remote driver

Open
#5,193 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/builder area/builder/buildkit status/0-triage
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

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
Reproduce
docker buildx create \
  --name remote-kubernetes \
  --driver remote \
  tcp://buildkitd.default.svc:1234 \
  --use
docker build -t test . --push
Expected behavior

docker build must run build on default buildx executor

docker version
Client:
 Version:           26.1.4
 API version:       1.45
 Go version:        go1.21.11
 Git commit:        5650f9b
 Built:             Wed Jun  5 11:27:57 2024
 OS/Arch:           linux/amd64
 Context:           default
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
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
Additional Info

docker buildx ls:

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the documented docker buildx create --driver remote setup and compare docker buildx build with docker build. Trace how the two commands handle the selected builder and Docker context; done means docker build runs with the expected buildx executor instead of attempting the unavailable Unix socket.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.