docker / docker/cli

The --format flag table directive does not work with docker inspect

Open
#1,103 1 comment 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

docker service inspect --format 'table {{.Spec.Name}}\t{{range .Endpoint.VirtualIPs}}{{.Addr}} {{end}}' $(docker service ls -q)
This is not printing a table, it's printing:

container1\t10.0.2.3 107.2.30.4

container2\t10.0.2.5 107.2.30.8

...etc...

Steps to reproduce the issue:

  1. Deploy a container as a service: docker service create ngnix will work
  2. Run command: docker service inspect --format 'table {{.Spec.Name}}\t{{range .Endpoint.VirtualIPs}}{{.Addr}} {{end}}' $(docker service ls -q)

Describe the results you received:

table sharp_goldstine\t

*Note service has no IP address, that's fine here

Describe the results you expected:

Table output similar to docker stats with 2 columns

Output of docker version:

Client:
 Version:      18.03.1-ce
 API version:  1.37
 Go version:   go1.9.5
 Git commit:   9ee9f40
 Built:        Thu Apr 26 07:13:02 2018
 OS/Arch:      darwin/amd64
 Experimental: false
 Orchestrator: swarm

Server:
 Engine:
  Version:      18.03.1-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.9.5
  Git commit:   9ee9f40
  Built:        Thu Apr 26 07:22:38 2018
  OS/Arch:      linux/amd64
  Experimental: true

Output of docker info:

Containers: 16
 Running: 9
 Paused: 0
 Stopped: 7
Images: 49
Server Version: 18.03.1-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: active
 NodeID: daldy4p8ynukd4mlf9p1wv1vx
 Is Manager: true
 ClusterID: hccuyor98zeifze8mexdc4uw0
 Managers: 1
 Nodes: 1
 Orchestration:
  Task History Retention Limit: 5
 Raft:
  Snapshot Interval: 10000
  Number of Old Snapshots to Retain: 0
  Heartbeat Tick: 1
  Election Tick: 3
 Dispatcher:
  Heartbeat Period: 5 seconds
 CA Configuration:
  Expiry Duration: 3 months
  Force Rotate: 0
 Autolock Managers: false
 Root Rotation In Progress: false
 Node Address: 192.168.65.2
 Manager Addresses:
  192.168.65.2:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 773c489c9c1b21a6d78b5c538cd395416ec50f88
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.87-linuxkit-aufs
Operating System: Docker for Mac
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.952GiB
Name: linuxkit-025000000001
ID: TXEI:TAOU:SCOP:BGAB:6KTA:3TZ3:46QJ:GORK:45NX:3K7J:MHFC:YXNY
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 106
 Goroutines: 243
 System Time: 2018-06-01T11:40:48.2385353Z
 EventsListeners: 7
HTTP Proxy: docker.for.mac.http.internal:3128
HTTPS Proxy: docker.for.mac.http.internal:3129
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Additional environment details (AWS, VirtualBox, physical, etc.):

Mac laptop

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 reproducing the provided docker service inspect command and compare its --format table handling with the docker stats output. Trace the CLI formatter entry point used by service inspect; done means the same command renders a two-column table rather than literal table text and tab escapes.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.