wip: Fix ContainerDashboard
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user