Display mapped ports, revert to ps command name #55
@ -83,14 +83,19 @@ def command(ctx, include, exclude, cluster, command, services):
|
|||||||
if verbose:
|
if verbose:
|
||||||
print("Running compose down")
|
print("Running compose down")
|
||||||
docker.compose.down()
|
docker.compose.down()
|
||||||
elif command == "status":
|
elif command == "ps":
|
||||||
if verbose:
|
if verbose:
|
||||||
print("Running compose ps")
|
print("Running compose ps")
|
||||||
container_list = docker.compose.ps()
|
container_list = docker.compose.ps()
|
||||||
if len(container_list) > 0:
|
if len(container_list) > 0:
|
||||||
print("Running containers:")
|
print("Running containers:")
|
||||||
for container in container_list:
|
for container in container_list:
|
||||||
print(f"id: {container.id}, name: {container.name}")
|
print(f"id: {container.id}, name: {container.name}, ports: ", end="")
|
||||||
|
ports = container.network_settings.ports
|
||||||
|
for port_mapping in ports.keys():
|
||||||
|
print(f"{ports[port_mapping][0]['HostIp']}:{ports[port_mapping][0]['HostPort']}->{port_mapping}", end=",")
|
||||||
|
# TODO: fix the extra comma
|
||||||
|
print()
|
||||||
else:
|
else:
|
||||||
print("No containers running")
|
print("No containers running")
|
||||||
elif command == "logs":
|
elif command == "logs":
|
||||||
|
Loading…
Reference in New Issue
Block a user