Search in sources :

Example 1 with Port

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;
}
Also used : Container(org.apache.karaf.docker.Container) ShellTable(org.apache.karaf.shell.support.table.ShellTable) Port(org.apache.karaf.docker.Port)

Aggregations

Container (org.apache.karaf.docker.Container)1 Port (org.apache.karaf.docker.Port)1 ShellTable (org.apache.karaf.shell.support.table.ShellTable)1