private void autoPullBaseImage(ImageConfiguration imageConfig, ImagePullManager imagePullManager, BuildContext buildContext, Map<String, String> buildArgs)
            throws DockerAccessException, MojoExecutionException {
        BuildImageConfiguration buildConfig = imageConfig.getBuildConfiguration();
        CleanupMode cleanupMode = buildConfig.cleanupMode();

        if (buildConfig.getDockerArchive() != null) {
            // No auto pull needed in archive mode
            return;
        }

        List<String> fromImages;
        if (buildConfig.isDockerFileMode()) {
            fromImages = extractBaseFromDockerfile(buildConfig, buildContext.getMojoParameters(), buildArgs);
        } else {
            fromImages = new LinkedList<>();
            String baseImage = extractBaseFromConfiguration(buildConfig);
            if (baseImage != null) {
                fromImages.add(baseImage);
            }
        }
        for (String fromImage : fromImages) {
            if (fromImage != null && !DockerAssemblyManager.SCRATCH_IMAGE.equals(fromImage)) {
                String oldImageId = null;
                if (cleanupMode.isRemove()) {
                    oldImageId = queryService.getImageId(fromImage);
                }

                registryService.pullImageWithPolicy(fromImage, imagePullManager, buildContext.getRegistryConfig(), buildConfig);

                String newImageId = queryService.getImageId(fromImage);

                removeDanglingImage(fromImage, 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