Search in sources :

Example 1 with DefaultDockerClientConfig

use of com.github.dockerjava.core.DefaultDockerClientConfig in project tutorials by eugenp.

the class DockerClientLiveTest method whenCreatingDockerClientWithProperties_thenReturnInstance.

@Test
public void whenCreatingDockerClientWithProperties_thenReturnInstance() {
    // when
    Properties properties = new Properties();
    properties.setProperty("registry.email", "info@bealdung.com");
    properties.setProperty("registry.url", "register.bealdung.io/v2/");
    properties.setProperty("registry.password", "strongpassword");
    properties.setProperty("registry.username", "bealdung");
    properties.setProperty("DOCKER_CERT_PATH", "/home/bealdung/public/.docker/certs");
    properties.setProperty("DOCKER_CONFIG", "/home/bealdung/public/.docker/");
    properties.setProperty("DOCKER_TLS_VERIFY", "1");
    properties.setProperty("DOCKER_HOST", "tcp://docker.bealdung.com:2376");
    DefaultDockerClientConfig config = DefaultDockerClientConfig.createDefaultConfigBuilder().withProperties(properties).build();
    DockerClient dockerClient = DockerClientBuilder.getInstance(config).build();
    // then
    assertNotNull(dockerClient);
}
Also used : DockerClient(com.github.dockerjava.api.DockerClient) Properties(java.util.Properties) DefaultDockerClientConfig(com.github.dockerjava.core.DefaultDockerClientConfig) Test(org.junit.Test)

Example 2 with DefaultDockerClientConfig

use of com.github.dockerjava.core.DefaultDockerClientConfig in project tutorials by eugenp.

the class DockerClientLiveTest method whenCreatingAdvanceDockerClient_thenReturnInstance.

@Test
public void whenCreatingAdvanceDockerClient_thenReturnInstance() {
    // when
    DefaultDockerClientConfig config = DefaultDockerClientConfig.createDefaultConfigBuilder().withRegistryEmail("info@bealdung.com").withRegistryUrl("register.bealdung.io/v2/").withRegistryPassword("strongpassword").withRegistryUsername("bealdung").withDockerCertPath("/home/bealdung/public/.docker/certs").withDockerConfig("/home/bealdung/public/.docker/").withDockerTlsVerify("1").withDockerHost("tcp://docker.beauldung.com:2376").build();
    DockerClient dockerClient = DockerClientBuilder.getInstance(config).build();
    // then
    assertNotNull(dockerClient);
}
Also used : DockerClient(com.github.dockerjava.api.DockerClient) DefaultDockerClientConfig(com.github.dockerjava.core.DefaultDockerClientConfig) Test(org.junit.Test)

Aggregations

DockerClient (com.github.dockerjava.api.DockerClient)2 DefaultDockerClientConfig (com.github.dockerjava.core.DefaultDockerClientConfig)2 Test (org.junit.Test)2 Properties (java.util.Properties)1