Open psychowood opened 2 months ago
Search bar for container filtering seems like a good idea.
I don't use swarm but if we can pull the stack name without adding extra overhead then I'm open to appending that on the name.
Can you hit the api and let me know if it shows the stack name somewhere? Piping to jq makes it a lot easier to read if you have that installed.
Container list:
curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" http://localhost/containers/json
Individual container resources (replace d07d19594b6e
with your container ID):
curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" "http://localhost/containers/d07d19594b6e/stats?stream=0&one-shot=1"
Afaik it needs to be looked up in labels.
Specifically, it's either the com.docker.compose.project
label if it is a docker compose project:
{
"Id": "16579c2c8892ba86e87ff0c97df68633a5b50c6e8d2341ef9884af9436ec4060",
...
"Labels": {
"com.docker.compose.project": "immich"
}
or com.docker.stack.namespace
if it was deployed via docker stack deploy in a swarm
{
"Id": "85e01d1d496525cb59b7483686caab167ff8c115c751e13107f5f068fbbcb5e5",
...
"Labels": {
"com.docker.stack.namespace": "admin-stack"
}
}
In the unlikely presence of both (perhaps caused when adding a compose project in a swarm manually, if even possible), the latter should take precedence.
Attached are the json responses from /containers and /stats for both a compose project and a native stack
stacks-container.json compose-container.json stacks-stats.json compose-stats.json
As per subject, I believe having the ability to filter by stack (and aggregate data by stack on the main view) could be very useful. I have dozen of containers and viewing them in the tooltip is very difficult / almost useless.
Also adding the stack name in front of the container could help:
something like 'immich-app | immick_machine_learning" and 'immich-app | immich'
Some notes/nice to have:
I could try to contribute if you feel like it :)