docker / docker/cli

Feature Request: Consistently support self in docker node commands

Open
#967 1 comment 16 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/swarm
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

Description

The docker node inspect command accepts the special value self as a reference to the current node.

Usage:	docker node inspect [OPTIONS] self|NODE [NODE...]

Other commands, like docker node update, do not have an equivalent.

Usage:	docker node update [OPTIONS] NODE

To update the current node, I have to find the node's ID or hostname.

$ NODE_NAME=$(docker info --format '{{ .Name }}')
$ docker node update --availability drain $NODE_NAME

Steps to reproduce the issue:

  1. Attempt to update the current node.
$ docker node update --availability drain self

Describe the results you received:

$ docker node update --availability drain self
Error: No such node: self

Describe the results you expected:

Like docker node inspect, I would like to be able to use self to reference the current node in other docker node commands.

$ docker node update --availability drain self
linuxkit-025000000001

Additional information you deem important (e.g. issue happens only occasionally):

Only docker node inspect supports self. docker node ps defaults to the current node (effectively self), if no nodes are specified.

command supports self
demote no
inspect yes
ls N/A
promote no
ps no; defaults to current node
rm no
update no

Output of docker version:

Client:
 Version:	18.03.0-ce-rc4
 API version:	1.37
 Go version:	go1.9.4
 Git commit:	fbedb97
 Built:	Thu Mar 15 07:33:28 2018
 OS/Arch:	darwin/amd64
 Experimental:	true
 Orchestrator:	swarm

Server:
 Engine:
  Version:	18.03.0-ce-rc4
  API version:	1.37 (minimum version 1.12)
  Go version:	go1.9.4
  Git commit:	fbedb97
  Built:	Thu Mar 15 07:42:29 2018
  OS/Arch:	linux/amd64
  Experimental:	true

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the docker node inspect, demote, promote, ps, rm, and update command entry points and their handling of node references. Check the existing self behavior and command usage text, then verify that self consistently resolves to the current node across the requested commands and that the documented examples work.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.