Search in sources :

Example 1 with ImageDelete

use of io.fabric8.docker.api.model.ImageDelete in project ballerina by ballerina-lang.

the class TestUtils method deleteDockerImage.

public static void deleteDockerImage(String imageName) {
    if (!imageName.contains(":")) {
        imageName += ":" + Constants.IMAGE_VERSION_LATEST;
    }
    DockerClient client = new io.fabric8.docker.client.DefaultDockerClient();
    List<ImageDelete> imageDeleteList = client.image().withName(imageName).delete().force().andPrune(false);
    for (ImageDelete imageDelete : imageDeleteList) {
        imageDelete.getDeleted();
        imageDelete.getUntagged();
    }
}
Also used : ImageDelete(io.fabric8.docker.api.model.ImageDelete) DockerClient(io.fabric8.docker.client.DockerClient)

Aggregations

ImageDelete (io.fabric8.docker.api.model.ImageDelete)1 DockerClient (io.fabric8.docker.client.DockerClient)1