public void tagImage(String imageName, String tag, String repo, CleanupMode cleanupMode) throws DockerAccessException {
        if (tag != null) {
            String fullImageName = new ImageName(imageName, tag).getNameWithOptionalRepository(repo);

            String oldImageId = null;
            if (cleanupMode.isRemove()) {
                oldImageId = queryService.getImageId(fullImageName);
            }

            docker.tag(imageName, fullImageName, true);
            log.info("Tagging image %s successful!", fullImageName);

            String newImageId = queryService.getImageId(fullImageName);

            removeDanglingImage(fullImageName, oldImageId, newImageId, cleanupMode, false);
        }
    }
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