DevOps Asked by executable on January 11, 2021
I’m trying to fecth the PublishedPort
from my docker service.
I think I’m close to fetch it. Here is the data :
[
{
"ID": "a51ijaddvaf1paeh1dn5p1k3",
"Version": {
"Index": 240
},
"CreatedAt": "2020-08-24T14:41:37.217303114Z",
"UpdatedAt": "2020-08-24T14:41:37.22448218Z",
"Spec": {
"Name": "My_app",
"Labels": {},
"TaskTemplate": {
"ContainerSpec": {
"Image": "tuxgasy/dolibarr:latest@sha256:a2d6c8e1ed7127c5cb74da2faj41a7a14zger77d4",
"Env": [
"DOLI_DB_HOST=HOST",
],
"Init": false,
"Mounts": [
{
"Type": "volume",
"Source": "nfsvolume",
"Target": "/FOLDER",
"VolumeOptions": {
"DriverConfig": {
"Name": "local",
"Options": {
"device": ":/FOLDER",
"o": "addr=192.168.0.1",
"type": "nfs"
}
}
}
},
{
"Type": "volume",
"Source": "nfsvolume",
"Target": "/FOLDER2",
"VolumeOptions": {
"DriverConfig": {
"Name": "local",
"Options": {
"device": ":/FOLDER2",
"o": "addr=192.168.0.1",
"type": "nfs"
}
}
}
}
],
"StopGracePeriod": 10000000000,
"DNSConfig": {},
"Isolation": "default"
},
"Resources": {
"Limits": {},
"Reservations": {}
},
"RestartPolicy": {
"Condition": "any",
"Delay": 5000000000,
"MaxAttempts": 0
},
"Placement": {
"Platforms": [
{
"Architecture": "amd64",
"OS": "linux"
}
]
},
"ForceUpdate": 0,
"Runtime": "container"
},
"Mode": {
"Replicated": {
"Replicas": 2
}
},
"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",
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 80,
"PublishMode": "ingress"
}
]
}
},
"Endpoint": {
"Spec": {
"Mode": "vip",
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 80,
"PublishMode": "ingress"
}
]
},
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 80,
"PublishedPort": 30001,
"PublishMode": "ingress"
}
],
"VirtualIPs": [
{
"NetworkID": "s8hkvdfzer42onr1ez4",
"Addr": "10.0.0.30/24"
}
]
}
}
]
I’m trying to fetch PublishedPort
.
I tried the following:
docker service inspect -f '{{with index .Spec.EndpointSpec.Ports 0}}{{.PublishedPort}}{{end}}' My_app
docker service inspect -f '{{with index .Spec.Endpoint.Spec.Ports 0}}{{.PublishedPort}}{{end}}' My_app
docker service inspect -f '{{.Spec.EndpointSpec.Ports 0}}{{.PublishedPort}}{{end}}' My_app
docker service inspect -f '{{with index .Spec.EndpointPorts 0}}{{.PublishedPort}}{{end}}' My_app
docker service inspect -f '{{with index .Spec.Endpoint.Ports 0}}{{.PublishedPort}}{{end}}' My_app
docker service inspect --format '{{json .Endpoint.Ports.PublishedPort}}' My_app
docker service inspect -f '{{with index .EndpointSpec.Ports 0}}{{.PublishedPort}}{{end}}' My_app
docker service inspect -f '{{with index .Spec.EndpointSpec.Ports 0}}{{.PublishedPort}}{{end}}' My_app
docker service inspect -f '{{with index .EndpointSpec.Ports 0}}{{.PublishedPort}}{{end}}' My_app
docker service inspect --format '{{json .Endpoint.Ports 0}}{{.PublishedPort}}' My_app
docker service inspect --format '{{json .Endpoint.Ports}}{{.PublishedPort}}' My_app
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP