wip: Fix ContainerDashboard

This commit is contained in:
Constantin
2025-09-13 15:49:32 +03:00
parent b40e4f277e
commit 36776353b9
7 changed files with 747 additions and 130 deletions
+23 -2
View File
@@ -316,13 +316,34 @@ class ContainerManager(BaseServiceManager):
if not self.client:
return {'error': 'Docker client not available'}
# Convert volumes dict to Docker volume format
volume_mounts = []
for host_path, container_path in volumes.items():
volume_mounts.append({
'bind': container_path,
'mode': 'rw'
})
# Create volume mapping for Docker
volume_map = {}
for host_path, container_path in volumes.items():
volume_map[host_path] = {
'bind': container_path,
'mode': 'rw'
}
# Create port bindings for Docker
port_bindings = {}
for container_port, host_port in ports.items():
port_bindings[container_port] = host_port
container = self.client.containers.create(
image=image,
name=name if name else None,
environment=env,
volumes=volumes,
volumes=volume_map,
command=command if command else None,
ports=ports,
ports=port_bindings,
detach=True
)
return {'id': container.id, 'name': container.name}