How to specify our own unique node ID or Node name to docker swarm nodes

Is there a way where we can specify our own unique node id so that it is reflected accordingly in below node output

ID HOSTNAME STATUS AVAILABILITY
15u5ohob9dpvemzhdb2rtcwgr 0-16-3e-33-0-0 Ready Active

Also, how can you specify a node name so that list node output reflects that in Spec.Name ?

{
“ID”: “24ifsmvkjbyhk”,
“Version”: {
“Index”: 8
},
“CreatedAt”: “2016-06-07T20:31:11.853781916Z”,
“UpdatedAt”: “2016-06-07T20:31:11.999868824Z”,
“Spec”: {
“Name”: “my-node”,
“Role”: “manager”,
“Availability”: “active”
“Labels”: {
“foo”: “bar”
}
}

bump!
Just opened https://github.com/docker/swarm/issues/2628

to sum up: having a placeholder {{.Node.Name}} in https://docs.docker.com/engine/reference/commandline/service_create/#create-services-using-templates which is the real docker host’s name

1 Like

Did you get any further then github issue which was closed? I still don’t see a way to pass nodename to container.

sadly not.
however, i have been busy with another tasks, so didn’t have time to insist/charge

Solved: https://github.com/moby/moby/issues/32561