@Override
    protected void executeInternal(ServiceHub hub) throws MojoExecutionException, IOException, ExecException {
        if(skip) {
            return;
        }

        QueryService queryService = hub.getQueryService();
        RunService runService = hub.getRunService();

        GavLabel gavLabel = getGavLabel();

        if (!keepRunning) {
            if (invokedTogetherWithDockerStart()) {
                runService.stopStartedContainers(keepContainer, removeVolumes, autoCreateCustomNetworks, gavLabel);
            } else {
                stopContainers(queryService, runService, gavLabel);
            }
        }

        // Switch off all logging
        LogDispatcher dispatcher = getLogDispatcher(hub);
        dispatcher.untrackAllContainerLogs();
    }
If true, the containers are not stopped right away, but when the build is finished (success or failed).
src/main/java/io/fabric8/maven/docker/StopMojo.java