docker / cli

The Docker CLI
Apache License 2.0
4.85k stars 1.91k forks source link

Bash completion script rises errors on "docker inspect" #1643

Open berlic opened 5 years ago

berlic commented 5 years ago

Description

Bash completion script rises daemon error messages on docker inspect.

It felt really nervous to receive this alarm from monitoring system:

Jan 28 10:00:17 ip-x-x-x-x dockerd[12716]: time="2019-01-28T10:00:17.896181265Z" level=error msg="Error getting nodes: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again."
Jan 28 10:00:17 ip-x-x-x-x dockerd[12716]: time="2019-01-28T10:00:17.896216789Z" level=error msg="Handler for GET /v1.39/nodes returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again."
Jan 28 10:00:18 ip-x-x-x-x dockerd[12716]: time="2019-01-28T10:00:18.006087978Z" level=error msg="Handler for GET /v1.39/secrets returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again."
Jan 28 10:00:18 ip-x-x-x-x dockerd[12716]: time="2019-01-28T10:00:18.064672897Z" level=error msg="Error getting services: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again."
Jan 28 10:00:18 ip-x-x-x-x dockerd[12716]: time="2019-01-28T10:00:18.064715972Z" level=error msg="Handler for GET /v1.39/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again."

I thought someone is snooping for secrets inside the network.

Steps to reproduce the issue:

  1. Install Docker-CE on Ubuntu Linux
  2. Type docker inspect <tab> in Bash
  3. Check /var/log/syslog

Describe the results you received: Error messages in log files

Describe the results you expected: No errors

Output of docker version:

Client:
 Version:           18.09.1
 API version:       1.39
 Go version:        go1.10.6
 Git commit:        4c52b90
 Built:             Wed Jan  9 19:35:31 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.1
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       4c52b90
  Built:            Wed Jan  9 19:02:44 2019
  OS/Arch:          linux/amd64
  Experimental:     false
stephankn commented 5 years ago

using set -x before docker inspect <tab> prints the commands executed by bash doing the completion.

Completion is sending the command docker node ls --format '{{.Hostname}}' which is then triggering the error message.

Maybe it would help to skip these calls when there is no swarm configured. Not certain whether there is an easy way to detect this. docker info | grep Swarm: gives some hints.

ratijas commented 3 years ago

Also, zsh completion is a complete mess. It does not raise an error. Instead, it is a huge pile of garbage and misaligned text.

Screenshot_20201128_013641

Something somewhere is terribly wrong with docker inspect.

Version

Docker version 19.03.13-ce, build 4484c46d9d OS: Arch Linux Package: community/docker 1:19.03.13-1