Open wdoekes opened 7 years ago
virt.docker:
{"my_container": {
"name": NAME,
"uptime": UPTIME(?),
"image_digest": HASH,
"image_tag": TAG,
"os.pkg": {
call os.pkg with container-root from
/proc/$(docker inspect -f '{{.State.Pid}}' whmcs-web)/root/
}}}
Example info:
# printf 'GET /containers/json HTTP/1.0\r\n\r\n' | nc -U /var/run/docker.sock | sed -e '1,/^.$/d' | jq
[
{
"Id": "390...",
"Names": [
"/xxx_sip_1"
],
"Image": "xxx_sip",
"ImageID": "sha256:dba...",
"Command": "/bin/sh -c 'while true; do sleep 60; done'",
"Created": 1498636085,
"Ports": [],
"Labels": {
"com.docker.compose.config-hash": "a8f...",
"com.docker.compose.container-number": "1",
"com.docker.compose.oneoff": "False",
"com.docker.compose.project": "xxx",
"com.docker.compose.service": "sip",
"com.docker.compose.version": "1.13.0"
},
"State": "running",
"Status": "Up 6 days",
"HostConfig": {
"NetworkMode": "xxx_net"
},
"NetworkSettings": {
"Networks": {
"xxx_net": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "484xxx",
"EndpointID": "b81xxx",
"Gateway": "172.20.0.254",
"IPAddress": "172.20.0.4",
"IPPrefixLen": 24,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:14:00:04"
}
}
},
"Mounts": []
},
Missing info:
"zfs"
write(3, "GET /v1.24/containers/390f566be012/json HTTP/1.1\r\nHost: docker\r\nUser-Agent: Docker-Client/1.12.6 (linux)\r\n\r\n", 108) = 108
[
{
"Id": "390...",
"Created": "2017-06-28T07:48:05.843224911Z",
"Path": "/bin/sh",
"Args": [
"-c",
"while true; do sleep 60; done"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 19938,
"ExitCode": 0,
"Error": "",
"StartedAt": "2017-06-28T07:48:06.291334324Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
FYI: filters:
GET /v1.24/containers/json?filters=%7B%22name%22%3A%7B%22xxx_sip_1%22%3Atrue%7D%7D
No column limiting there.
Just fetch the docker containers through /containers/json | jq .[].Id
directly.
Similar to app.vzlist, an app.dockerps but with dpkg-listings..
Something like that...