test: tags print
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import docker
|
||||
from ctypes.wintypes import tagSIZE
|
||||
|
||||
client = docker.from_env()
|
||||
running_containers = []
|
||||
sleeping_containers = []
|
||||
for c in client.containers.list(all=True):
|
||||
info = c.attrs # словарь со всеми данными
|
||||
image = info["Config"]["Image"] # образ
|
||||
created = info["Created"] # время создания
|
||||
labels = info["Config"].get("Labels", {}) # лейблы
|
||||
ports = info["NetworkSettings"]["Ports"] # проброшенные порты ЪЪЪ
|
||||
mounts = info.get("Mounts", []) # маунты
|
||||
status = c.status # статус контейнера (вкл-выкл)
|
||||
tags = c.image.tags
|
||||
container = {
|
||||
"name": c.name,
|
||||
"image": image,
|
||||
"id": c.id[:12],
|
||||
"create_time": created,
|
||||
"mounted_data": mounts,
|
||||
"labels": labels
|
||||
}
|
||||
if status == "running":
|
||||
running_containers.append(container)
|
||||
else:
|
||||
sleeping_containers.append(container)
|
||||
print(tags)
|
||||
Reference in New Issue
Block a user