Container builder endpoint should default to context name
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 4.5k
- Forks
- 682
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 29
Description
When a docker-container builder is created without specifying an endpoint it will default to the docker endpoint meta host if default docker context is used whereas it will be the context name if docker context is not default:
$ docker context ls
NAME TYPE DESCRIPTION DOCKER ENDPOINT KUBERNETES ENDPOINT ORCHESTRATOR
default * moby Current DOCKER_HOST based configuration unix:///var/run/docker.sock swarm
$ docker buildx create --name foo
$ docker buildx ls
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
foo docker-container
foo0 unix:///var/run/docker.sock inactive
default * docker
default default running 20.10.20 linux/arm64, linux/amd64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6
$ docker context create bar
$ docker context use bar
$ docker context ls
NAME TYPE DESCRIPTION DOCKER ENDPOINT KUBERNETES ENDPOINT ORCHESTRATOR
bar * moby unix:///var/run/docker.sock swarm
default moby Current DOCKER_HOST based configuration unix:///var/run/docker.sock swarm
$ docker buildx create --name foo2
$ docker buildx ls
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
foo docker-container
foo0 unix:///var/run/docker.sock inactive
foo2 docker-container
foo20 bar inactive
bar docker
bar bar running 20.10.20 linux/arm64, linux/amd64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6
default * docker
default default running 20.10.20 linux/arm64, linux/amd64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6
Here the endpoint is unix:///var/run/docker.sock for foo0 node with default context. I think the endpoint should be default otherwise if server host changes, the builder will not be accessible anymore whereas having the context name will correctly resolve the updated context endpoint.
This is an issue I encounter when I want to switch and share the buildx store on WSL and Windows host because default context has an unix socket endpoint on WSL unix:///var/run/docker.sock but a named pipe on Windows npipe:////./pipe/docker_engine.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two context cases with docker buildx create and docker buildx ls, then inspect store/storeutil/storeutil.go around lines 27-38. Done means a docker-container builder created without an endpoint retains the context name, including for the default context, so it can resolve a changed host endpoint.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- cli, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100