cli icon indicating copy to clipboard operation
cli copied to clipboard

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

Open mikebski opened this issue 6 years ago • 1 comments

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

mikebski avatar Jun 01 '18 11:06 mikebski