docker-api-rs
docker-api-rs copied to clipboard
PortStatus not present in TaskStatusInlineItem
TaskStatusInlineItem
doesn't have PortStatus
field, docker swagger doesn't have it too.
Status:
type: "object"
properties:
Timestamp:
type: "string"
format: "dateTime"
State:
$ref: "#/definitions/TaskState"
Message:
type: "string"
Err:
type: "string"
ContainerStatus:
type: "object"
properties:
ContainerID:
type: "string"
PID:
type: "integer"
ExitCode:
type: "integer"
But it present in source code https://github.com/moby/moby/blob/master/api/types/swarm/task.go#L197 and may be acquired from
curl --silent -XGET --unix-socket /var/run/docker.sock http://localhost/tasks | jq .
{
"ID": "jz0dy04hqqiee7req68cn35sr",
"Version": {
"Index": 13330
},
"CreatedAt": "2023-07-21T17:11:15.900415099Z",
"UpdatedAt": "2023-07-21T17:11:18.903307684Z",
"Labels": {},
"Spec": {
"ContainerSpec": {
"Image": "nginx",
"Isolation": "default"
},
"ForceUpdate": 0
},
"ServiceID": "19q4qqid37yiht0ex82j89s4u",
"Slot": 2,
"NodeID": "d9y196uwpsfu83dub7wj9he9i",
"Status": {
"Timestamp": "2023-07-21T17:11:18.820798223Z",
"State": "running",
"Message": "started",
"ContainerStatus": {
"ContainerID": "6b319540150cd1c551db0ec80962435077910965ea4a96535444a40bf83dafb0",
"PID": 159542,
"ExitCode": 0
},
"PortStatus": {
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 80,
"PublishedPort": 32774,
"PublishMode": "host"
},
{
"Protocol": "tcp",
"TargetPort": 80,
"PublishedPort": 32774,
"PublishMode": "host"
}
]
}
},
"DesiredState": "running",
"Volumes": null
}
- Crate version: master
- OS: Arch Linux
- Output of running
docker version
on the command line:
Version: 24.0.2
API version: 1.43
Go version: go1.20.4
Git commit: cb74dfcd85
Built: Mon May 29 15:50:06 2023
OS/Arch: linux/amd64
Context: default
Server:
Engine:
Version: 24.0.2
API version: 1.43 (minimum version 1.12)
Go version: go1.20.4
Git commit: 659604f9ee
Built: Mon May 29 15:50:06 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.7.2
GitCommit: 0cae528dd6cb557f7201036e9f43420650207b58.m
runc:
Version: 1.1.8
GitCommit:
docker-init:
Version: 0.19.0
GitCommit: de40ad0