use of com.github.dockerjava.httpclient5.ApacheDockerHttpClient.Builder in project quorum-acceptance-tests by ConsenSys.
the class DockerInfrastructureService method afterPropertiesSet.
@Override
public void afterPropertiesSet() throws Exception {
DefaultDockerClientConfig.Builder configBuilder = DefaultDockerClientConfig.createDefaultConfigBuilder();
if (StringUtils.isNotBlank(networkProperty().getDockerInfrastructure().getHost())) {
configBuilder.withDockerHost(networkProperty().getDockerInfrastructure().getHost());
}
DefaultDockerClientConfig config = configBuilder.build();
infraProperty = networkProperty().getDockerInfrastructure();
DockerHttpClient httpClient = new ApacheDockerHttpClient.Builder().dockerHost(config.getDockerHost()).sslConfig(config.getSSLConfig()).build();
dockerClient = DockerClientImpl.getInstance(config, httpClient);
quorumDockerImageCatalog = ImmutableMap.<String, QuorumImageConfig>builder().put("develop", new QuorumImageConfig(Optional.ofNullable(infraProperty.getTargetQuorumImage()).orElse("quorumengineering/quorum:develop"), GethArgBuilder.newBuilder().allowInsecureUnlock(true))).put("latest", new QuorumImageConfig("quorumengineering/quorum:latest", GethArgBuilder.newBuilder().allowInsecureUnlock(true))).put("v2.5.0", new QuorumImageConfig("quorumengineering/quorum:2.5.0", GethArgBuilder.newBuilder())).put("21.1.0", new QuorumImageConfig("quorumengineering/quorum:21.1.0", GethArgBuilder.newBuilder().allowInsecureUnlock(true))).put("21.4.0", new QuorumImageConfig("quorumengineering/quorum:21.4.0", GethArgBuilder.newBuilder().allowInsecureUnlock(true))).put("21.10.0", new QuorumImageConfig("quorumengineering/quorum:21.10.0", GethArgBuilder.newBuilder().allowInsecureUnlock(true))).put("2.7.0", new QuorumImageConfig("quorumengineering/quorum:2.7.0", GethArgBuilder.newBuilder().allowInsecureUnlock(true))).build();
tesseraDockerImageCatalog = ImmutableMap.of("develop", Optional.ofNullable(infraProperty.getTargetTesseraImage()).orElse("quorumengineering/tessera:develop"), "latest", "quorumengineering/tessera:latest", "0.10.5", "quorumengineering/tessera:0.10.5", "21.1.0", "quorumengineering/tessera:21.1.0", "21.10.0", "quorumengineering/tessera:21.10.0");
}
use of com.github.dockerjava.httpclient5.ApacheDockerHttpClient.Builder in project Jpom by dromara.
the class TestSwarm method client.
private DockerClient client(String host) {
DefaultDockerClientConfig.Builder builder = DefaultDockerClientConfig.createDefaultConfigBuilder().withDockerHost("tcp://" + host + ":2375");
if (StrUtil.equals(host, nodeLt)) {
builder.withDockerTlsVerify(true).withDockerCertPath("/Users/user/fsdownload/docker-ca");
}
DockerClientConfig config = builder.build();
DockerHttpClient httpClient = new ApacheDockerHttpClient.Builder().dockerHost(config.getDockerHost()).sslConfig(config.getSSLConfig()).maxConnections(100).build();
DockerClient dockerClient = DockerClientImpl.getInstance(config, httpClient);
dockerClient.pingCmd().exec();
return dockerClient;
}
use of com.github.dockerjava.httpclient5.ApacheDockerHttpClient.Builder in project synopsys-detect by blackducksoftware.
the class DetectDockerRunner method connectToDocker.
public DockerClient connectToDocker() {
DefaultDockerClientConfig.Builder builder = DefaultDockerClientConfig.createDefaultConfigBuilder();
// But for Windows, unless told not to: use the Windows default docker host value
if (OperatingSystemType.determineFromSystem() == OperatingSystemType.WINDOWS) {
builder.withDockerHost("npipe:////./pipe/docker_engine");
}
DockerClientConfig config = builder.build();
DockerHttpClient httpClient = new ApacheDockerHttpClient.Builder().dockerHost(config.getDockerHost()).sslConfig(config.getSSLConfig()).maxConnections(100).build();
return DockerClientImpl.getInstance(config, httpClient);
}
use of com.github.dockerjava.httpclient5.ApacheDockerHttpClient.Builder in project webdrivermanager by bonigarcia.
the class DockerService method getDockerClient.
private DockerClient getDockerClient(String dockerHost) {
DefaultDockerClientConfig.Builder dockerClientConfigBuilder = DefaultDockerClientConfig.createDefaultConfigBuilder();
if (!isNullOrEmpty(dockerHost)) {
dockerClientConfigBuilder.withDockerHost(dockerHost);
}
DockerClientConfig dockerClientConfig = dockerClientConfigBuilder.build();
dockerHostUri = dockerClientConfig.getDockerHost();
ApacheDockerHttpClient dockerHttpClient = new Builder().dockerHost(dockerHostUri).build();
return DockerClientBuilder.getInstance(dockerClientConfig).withDockerHttpClient(dockerHttpClient).build();
}
use of com.github.dockerjava.httpclient5.ApacheDockerHttpClient.Builder in project kestra by kestra-io.
the class DockerScriptRunner method getDockerClient.
private DockerClient getDockerClient(AbstractBash abstractBash, RunContext runContext, Path workingDirectory) throws IllegalVariableEvaluationException, IOException {
DefaultDockerClientConfig.Builder dockerClientConfigBuilder = DefaultDockerClientConfig.createDefaultConfigBuilder();
if (abstractBash.getDockerOptions() != null) {
if (abstractBash.getDockerOptions().getDockerHost() != null) {
dockerClientConfigBuilder.withDockerHost(runContext.render(abstractBash.getDockerOptions().getDockerHost()));
}
if (abstractBash.getDockerOptions().getDockerConfig() != null) {
Path docker = Files.createTempDirectory(workingDirectory, "docker");
Path file = Files.createFile(docker.resolve("config.json"));
Files.write(file, runContext.render(abstractBash.getDockerOptions().getDockerConfig()).getBytes());
dockerClientConfigBuilder.withDockerConfig(docker.toFile().getAbsolutePath());
}
}
DockerClientConfig dockerClientConfig = dockerClientConfigBuilder.build();
ApacheDockerHttpClient dockerHttpClient = new Builder().dockerHost(dockerClientConfig.getDockerHost()).build();
return DockerClientBuilder.getInstance(dockerClientConfig).withDockerHttpClient(dockerHttpClient).build();
}
Aggregations