docker service inspect --pretty should show secrets/configs
Open
Nobody has claimed this yet.
area/swarm
area/ux
exp/beginner
kind/enhancement
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
Create a service using a secret and a config:
echo "bla" | docker config create foo.conf -
echo "bla" | docker secret create secret.conf -
docker service create -d \
--config source=foo.conf,target=/foo.conf,uid=123,gid=456 \
--secret source=secret.conf,target=/secret.conf,uid=234,gid=567 \
--replicas 1 \
--name myservice \
nginx:alpine
Inspect the service with the --pretty option:
docker service inspect myservice --pretty
ID: ib7yble4rm5qbz3ijmk83cxeh
Name: myservice
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:48947591194ac5a9dce1e110f9198a547debb21630f121081640b87d99ca8b11
Resources:
Endpoint Mode: vip
Notice that no information about the configs or secrets is printed.
Inspect the service without --pretty:
docker service inspect myservice
[
{
"ID": "ib7yble4rm5qbz3ijmk83cxeh",
"Version": {
"Index": 776
},
"CreatedAt": "2018-02-28T09:42:57.612406537Z",
"UpdatedAt": "2018-02-28T09:42:57.612406537Z",
"Spec": {
"Name": "myservice",
"Labels": {},
"TaskTemplate": {
"ContainerSpec": {
"Image": "nginx:alpine@sha256:48947591194ac5a9dce1e110f9198a547debb21630f121081640b87d99ca8b11",
"StopGracePeriod": 10000000000,
"DNSConfig": {},
"Secrets": [
{
"File": {
"Name": "/secret.conf",
"UID": "234",
"GID": "567",
"Mode": 292
},
"SecretID": "yv9vtn86nugxsbshu1ccumlod",
"SecretName": "secret.conf"
}
],
"Configs": [
{
"File": {
"Name": "/foo.conf",
"UID": "123",
"GID": "456",
"Mode": 292
},
"ConfigID": "j915gbt419wv9022nr2w8pqdh",
"ConfigName": "foo.conf"
}
],
"Isolation": "default"
},
"Resources": {
"Limits": {},
"Reservations": {}
},
"RestartPolicy": {
"Condition": "any",
"Delay": 5000000000,
"MaxAttempts": 0
},
"Placement": {
"Platforms": [
{
"Architecture": "amd64",
"OS": "linux"
},
{
"Architecture": "arm64",
"OS": "linux"
},
{
"Architecture": "386",
"OS": "linux"
},
{
"Architecture": "ppc64le",
"OS": "linux"
},
{
"Architecture": "s390x",
"OS": "linux"
}
]
},
"ForceUpdate": 0,
"Runtime": "container"
},
"Mode": {
"Replicated": {
"Replicas": 1
}
},
"UpdateConfig": {
"Parallelism": 1,
"FailureAction": "pause",
"Monitor": 5000000000,
"MaxFailureRatio": 0,
"Order": "stop-first"
},
"RollbackConfig": {
"Parallelism": 1,
"FailureAction": "pause",
"Monitor": 5000000000,
"MaxFailureRatio": 0,
"Order": "stop-first"
},
"EndpointSpec": {
"Mode": "vip"
}
},
"Endpoint": {
"Spec": {}
}
}
]
Notice that information about secrets and configs is present, so this would be an easy change (just adjusting the template for --pretty)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the docker service inspect --pretty output/template and compare it with the full docker service inspect JSON shown in the issue. Reproduce the service with one config and one secret, then verify that the pretty output includes both resources and their file details.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100