private void removeImage(String oldImageName, String oldImageId, CleanupMode cleanupMode, boolean force) throws DockerAccessException {
        try {
            docker.removeImage(oldImageId, force);
            log.info("%s: Removed dangling image %s", oldImageName, oldImageId);
        } catch (DockerAccessException exp) {
            if (cleanupMode == CleanupMode.TRY_TO_REMOVE) {
                log.warn("%s: %s (dangling image)%s", oldImageName, exp.getMessage(),
                        (exp.getCause() != null ? " [" + exp.getCause().getMessage() + "]" : ""));
            } else {
                throw exp;
            }
        }
    }
Build an image

@param imageConfig the image configuration
@param params      mojo params for the project
@param noCache     if not null, dictate the caching behaviour. Otherwise its taken from the build configuration
@param buildArgs   docker build args
@throws DockerAccessException
@throws MojoExecutionException
src/main/java/io/fabric8/maven/docker/service/BuildService.java