use of org.apache.karaf.docker.Port in project karaf by apache.
the class PsCommand method execute.
@Override
public Object execute() throws Exception {
ShellTable table = new ShellTable();
table.column("Id");
table.column("Names");
table.column("Command");
table.column("Created");
table.column("Image");
table.column("Image ID");
table.column("Status");
table.column("State");
table.column("Ports");
table.column("Size");
table.column("Size Root");
for (Container container : getDockerService().ps(showAll, url)) {
StringBuilder portBuffer = new StringBuilder();
for (Port port : container.getPorts()) {
portBuffer.append(port.getType()).append(":").append(port.getPrivatePort()).append(":").append(port.getPublicPort()).append(" ");
}
table.addRow().addContent(container.getId(), container.getNames(), container.getCommand(), container.getCreated(), container.getImage(), container.getImageId(), container.getStatus(), container.getState(), portBuffer.toString(), container.getSizeRw(), container.getSizeRootFs());
}
table.print(System.out);
return null;
}
Aggregations