In the example below I am operating with two nodes in a docker swarm. The first node is a Linux node that shows the expected node name "myNode-001" while the second node is a windows 10 PC showing the generic node name "docker-desktop".
How can I change the docker node name of the Windows 10 docker-desktop node (to e.g. "myNode-002" or my PC name DESKTOP-XXXXXXX)?
$ docker service ps helloworld
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
v4djpoxgo5b9 helloworld.1 alpine:latest myNode-001 Running Running 10 minutes ago
50c69xw4tmod helloworld.2 alpine:latest docker-desktop <=== Running Running 2 minutes ago
Logging into the docker-desktop distro $> wsl -d docker-dektop
and running $> hostname
yields my Windows PC name DESKTOP-XXXXXXX. Apparently docker-desktop inherits my Windows PC hostname as expected.
Running $> docker system info
in a command shell on my Windows PC yields several properties. One of them is Name: docker-desktop
. This is the same name as which shows up in my node list on the swarm master. It is also the same name used by for the WSL2 docker-desktop repo.
It may look like that the swarm node name is actually taken from the docker-desktop repo name and not from the docker-desktop repo hostname.
$> wsl -l
Windows Subsystem for Linux Distributions:
docker-desktop-data (default)
docker-desktop
Not sure if this is a bug or a feature. The goal is still the same: to discriminate between multiple docker-desktops when perusing nodes on the swarm master. Hard to do when they all are showing with the same node name.