Show SecretID and ConfigID with --Pretty in inspect service #2834
+4
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
- What I did
@thaJeztah
I'm new to docker, so I didn't really solve a bug but I followed the project and read the CLI codebase, I only want to make a suggestion based on showing Config/Secret with --Pretty, I was thinking since the --pretty is meant to show the service details for simple understanding for people who are not programmers, does that mean the Config/Secret ID's should not show with --pretty.
- How I did it
I ran the CLI code, created a service with Config and secret.
echo "bla" | docker config create foo.conf -
echo "bla" | docker secret create secret.conf -
Create Service
docker service create -d\
--label foo=bar \
--label bar=baz \
--config src=foo.conf,target=/foo/config \
--config src=foo.conf,target=/bar/config \
--secret src=secret.conf,target=/foo/secret \
--secret src=secret.conf,target=/bar/secret \
--mount type=volume,src=foobar,target=/bax \
--mount type=volume,src=foobar,target=/baz \
--network bridge \
--name testie \
nginx:alpine
Check with Pretty
docker service inspect testie --pretty
- How to verify it
I haven't been able to verify it, that's why I'm making the suggestion, would it not look nice with the ConfigID/SecretID carrying its IDs when showing with
--pretty
, This push has a change in the format.go file of service to display the SecretID and ConfigID{{- if .Configs}}
Configs:
{{- range $config := .Configs }}
ConfigID: {{$config.ConfigID}}
Target: {{$config.File.Name}}
Source: {{$config.ConfigName}}
{{- end }}{{ end }}
{{- if .Secrets }}
Secrets:
{{- range $secret := .Secrets }}
ID: {{$secret.SecretID}}
Target: {{$secret.File.Name}}
Source: {{$secret.SecretName}}
{{- end }}{{ end }}
- Description for the changelog
Here's the printout
ID: jah2kj5dkkeiivikdwaqx1646
Name: testie
Labels:
bar=baz
foo=bar
Service Mode: Replicated
Replicas: 1
Placement:
UpdateConfig:
Parallelism: 1
On failure: pause
Monitoring Period: 5s
Max failure ratio: 0
Update order: stop-first
RollbackConfig:
Parallelism: 1
On failure: pause
Monitoring Period: 5s
Max failure ratio: 0
Rollback order: stop-first
ContainerSpec:
Image: nginx:alpine@sha256:5aa44b407756b274a600c7399418bdfb1d02c33317ae27fd5e8a333afb115db1
Init: false
Mounts:
Target: /bax
Source: foobar
ReadOnly: false
Type: volume
Target: /baz
Source: foobar
ReadOnly: false
Type: volume
Configs:
Target: /foo/config
Source: foo.conf
Target: /bar/config
Source: foo.conf
Secrets:
Target: /foo/secret
Source: secret.conf
Target: /bar/secret
Source: secret.conf
Resources:
Networks: bridge
Endpoint Mode: vip
The ID are still missing.
This is just a suggestion for better reading.
- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah This is a reference to the #908