Search in sources :

Example 1 with DockerMachineConfiguration

use of io.fabric8.maven.docker.config.DockerMachineConfiguration in project docker-maven-plugin by fabric8io.

the class DockerAccessFactory method getDefaultDockerHostProviders.

/**
 * Return a list of providers which could delive connection parameters from
 * calling external commands. For this plugin this is docker-machine, but can be overridden
 * to add other config options, too.
 *
 * @return list of providers or <code>null</code> if none are applicable
 */
private List<DockerConnectionDetector.DockerHostProvider> getDefaultDockerHostProviders(DockerAccessContext dockerAccessContext, Logger log) {
    DockerMachineConfiguration config = dockerAccessContext.getMachine();
    if (dockerAccessContext.isSkipMachine()) {
        config = null;
    } else if (config == null) {
        Properties projectProps = dockerAccessContext.getProjectProperties();
        if (projectProps.containsKey(DockerMachineConfiguration.DOCKER_MACHINE_NAME_PROP)) {
            config = new DockerMachineConfiguration(projectProps.getProperty(DockerMachineConfiguration.DOCKER_MACHINE_NAME_PROP), projectProps.getProperty(DockerMachineConfiguration.DOCKER_MACHINE_AUTO_CREATE_PROP));
        }
    }
    List<DockerConnectionDetector.DockerHostProvider> ret = new ArrayList<>();
    ret.add(new DockerMachine(log, config));
    return ret;
}
Also used : DockerMachine(io.fabric8.maven.docker.access.DockerMachine) DockerMachineConfiguration(io.fabric8.maven.docker.config.DockerMachineConfiguration) ArrayList(java.util.ArrayList) Properties(java.util.Properties)

Example 2 with DockerMachineConfiguration

use of io.fabric8.maven.docker.config.DockerMachineConfiguration in project docker-maven-plugin by fabric8io.

the class DockerMachineIT method testLaunchDockerMachine.

@Test
public void testLaunchDockerMachine() throws Exception {
    DockerMachineConfiguration mc = new DockerMachineConfiguration("default", "true");
    DockerMachine de = new DockerMachine(new AnsiLogger(new SystemStreamLog(), true, true), mc);
    Assert.assertTrue(de.getConnectionParameter(null) != null);
}
Also used : DockerMachine(io.fabric8.maven.docker.access.DockerMachine) SystemStreamLog(org.apache.maven.plugin.logging.SystemStreamLog) DockerMachineConfiguration(io.fabric8.maven.docker.config.DockerMachineConfiguration) AnsiLogger(io.fabric8.maven.docker.util.AnsiLogger) Test(org.junit.Test)

Aggregations

DockerMachine (io.fabric8.maven.docker.access.DockerMachine)2 DockerMachineConfiguration (io.fabric8.maven.docker.config.DockerMachineConfiguration)2 AnsiLogger (io.fabric8.maven.docker.util.AnsiLogger)1 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1 SystemStreamLog (org.apache.maven.plugin.logging.SystemStreamLog)1 Test (org.junit.Test)1