DOCKER_HOST not respected?

Logged in with Docker Desktop version 4.6.1 and a Team subscription,.

Adding DOCKER_HOST=unix:///var/run/docker.sock in accordance to this FAQ instruction and the build still happens locally with this command:
docker buildx build --platform linux/amd64,linux/arm64 --push --tag "testtag" --tag "latest" demoinstance

Is it Windows or Mac or Linux beta desktop? I can’t test it right know, but if it is Windows, have you tried it with a valid DOCKER_HOST for Windows? What is your goal? Do you want to test an invalid host/socket?

It is not Beta: Docker Engine v20.10.13 with Docker Desktop 4.6.1 (76265) is currently the newest version available.

My end goal is to [build on Docker Hub because of this page docker docs dot docker dot com docker-hub/builds (sorry no URL, new users can not put more than one link in a post)

Docker Hub can automatically build images from source code in an external repository and automatically push the built image to your Docker repositories.

But I am having trouble even testing it by building from a local repository, so I am currently trying to do this docker docs dot docker dot com buildx/working-with-buildx/#work-with-builder-instances (sorry no URL, new users can not put more than one link in a post):

Work with builder instances

To use a remote node you can specify the DOCKER_HOST or the remote context name while creating the new builder. After creating a new instance, you can manage its lifecycle using the docker buildx inspect, docker buildx stop and docker buildx rm commands. To list all available builders, use docker buildx ls . After creating a new builder you can also append new nodes to it.

As mentioned, I am supposed to set DOCKER_HOST, but it is not respected.

Sorry, but you still haven’t answered the most important question. I was probably not clear. Stable Docker Desktop can be installed on MacOS and Windows. I also mentioned Docker Desktop for Linux just to make sure I cover all the supported platforms. Since you mentioned you don’t use Beta, it means you use either Windows or MacOS. If I am right in the rest of my answer, it doesn’t actually matter.

DOCKER_HOST=unix:///var/run/docker.sock willl not work on Windows, unless you try in a WSL2 distribution or in a Linux virtual machine.

Since you posted your question I checked the documentation and I realized you shared only a paragraph in the middle. Actually, the first sentence of the shared part tells us DOCKER_HOST is required to “create” the builder and not to build.

There is an other important statement at the end of the section:

You can also set the context name as the target when you create a new builder instance or when you add a node to it.

It also confirms that the current configuration what matters when you create your builder. Since the DOCKER_HOST (which is a part of a context too) only points to one unix or TCP socket or npipe on Windows and buildx can build on multiple machines, you don’t need to change the environment variable or the context to run the builders on those machines.


I forgot to mention that if you use the default builder, then the environment variable should work, but only if that is valid:

By default, Buildx uses the docker driver if it is supported, providing a user experience very similar to the native docker build . Note that you must use a local shared daemon to build your applications.

I use both Mac OS 12 and Windows 10 (with WSL 2). Same issue on both.