@Override
    @SuppressWarnings("unchecked")
    public List<ImageConfiguration> resolve(ImageConfiguration unresolvedConfig, MavenProject project, MavenSession session) {
        DockerComposeConfiguration handlerConfig = new DockerComposeConfiguration(unresolvedConfig.getExternalConfig());
        File composeFile = resolveComposeFileAbsolutely(handlerConfig.getBasedir(), handlerConfig.getComposeFile(), project);
        Map<String, DockerComposeServiceWrapper> allServices = new LinkedHashMap<>();

        // First retrieve all services from the compose file
        for (Object composeO : getComposeConfigurations(composeFile, project, session)) {
            Map<String, Object> compose = (Map<String, Object>) composeO;
            validateVersion(compose, composeFile);
            Map<String, Object> services = (Map<String, Object>) compose.get("services");
            for (Map.Entry<String, Object> entry : services.entrySet()) {
                String serviceName = entry.getKey();
                Map<String, Object> serviceDefinition = (Map<String, Object>) entry.getValue();

                allServices.put(serviceName, new DockerComposeServiceWrapper(serviceName, composeFile, serviceDefinition,
                    unresolvedConfig, resolveAbsolutely(handlerConfig.getBasedir(), project)));
            }
        }
        
        // Loop over all known services and add wait configurations where necessary
        for (DockerComposeServiceWrapper service : allServices.values()) {
            for (String dependentServiceName : service.getDependsOn()) {
                DockerComposeServiceWrapper dependentService = allServices.get(dependentServiceName);
                
                if (dependentService != null) {
                    if (service.equals(dependentService)) {
                        service.throwIllegalArgumentException("Invalid self-reference in dependent services");
                    }
                    
                    // Note: for short syntax, we don't need to do anything else
                    if (service.usesLongSyntaxDependsOn()) {
                        dependentService.enableWaitCondition(service.getWaitCondition(dependentServiceName));
                    }
                } else {
                    service.throwIllegalArgumentException("Undefined dependent service \"" + dependentServiceName + "\"");
                }
            }
        }
        
        // Now that we cross-correlated all dependencies from all services, let's build & return image configurations
        return allServices.values().stream()
            .map(svc -> buildImageConfiguration(svc, composeFile.getParentFile(), unresolvedConfig, handlerConfig))
            .collect(Collectors.toList());
    }
Docker Compose handler for allowing a docker-compose file to be used
to specify the docker images.
src/main/java/io/fabric8/maven/docker/config/handler/compose/DockerComposeConfigHandler.java