2

On my windows 11 home system, running docker desktop v4.15.0, engine 20.10.21, I can run >docker buildx ls to get the expected platforms output (following the docs: https://docs.docker.com/engine/reference/commandline/buildx_ls/):

NAME/NODE       DRIVER/ENDPOINT STATUS  BUILDKIT PLATFORMS
default *       docker
  default       default         running 20.10.21 linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6
desktop-linux   docker
  desktop-linux desktop-linux   running 20.10.21 linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6

But continuing with the docs (https://docs.docker.com/engine/reference/commandline/buildx_create/), when running docker buildx create --name mybuilder mybuilder, I get the following:

ERROR: failed to initialize builder mybuilder (mybuilder0): error during connect: Get "http://mybuilder:2375/v1.24/info": dial tcp: lookup mybuilder: no such host

Following this post https://github.com/docker/buildx/issues/174, I have uninstalled/deleted docker files with no success. I saw mention of the hypervisor settings, but I'm running home edition. I have also ran wsl --update. I'm able to create images and run containers without any issues.

What configuration could I be missing to properly create the builder?

Docuemada
  • 1,703
  • 2
  • 25
  • 44
  • 1
    The documentation suggests the non-option argument to `docker buildx create` is either a context name or an endpoint; if you're not using one of the names `docker context ls` outputs then it looks like it's interpreting it as a hostname. Does `docker buildx create --name mybuilder default` work better? (Do you need this command at all? You shouldn't just to `docker build` an image.) – David Maze Dec 31 '22 at 01:24
  • @DavidMaze using ```default``` did worked. Using the typical ```docker buildx create mybuilder``` that is shown in many tutorials is what prompted the error message to begin with. If you want to post this as an answer, I'll accept so that it might help others who run into this possible sticking point. – Docuemada Dec 31 '22 at 15:31

1 Answers1

3

The non-option argument to docker buildx create is either a Docker context name or the location of a remote Docker daemon. You can find the context names using docker context ls; the examples there suggest there will usually be a context named default. This implies you should run

docker buildx create \
  --name mybuilder   \
  default               # context name, not builder name

If you try to use another name here, your error message suggests that Docker interprets it as a bare host name, and tries to contact it using a wildly insecure unauthenticated and unencrypted HTTP connection.

Note that, for routine use, you can just docker build images without using the docker buildx series of commands or interacting with the Docker CLI context system at all.

David Maze
  • 130,717
  • 29
  • 175
  • 215