当前位置: 首页>>代码示例>>Java>>正文


Java DockerCertificateException类代码示例

本文整理汇总了Java中com.spotify.docker.client.exceptions.DockerCertificateException的典型用法代码示例。如果您正苦于以下问题:Java DockerCertificateException类的具体用法?Java DockerCertificateException怎么用?Java DockerCertificateException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DockerCertificateException类属于com.spotify.docker.client.exceptions包,在下文中一共展示了DockerCertificateException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupCerts

import com.spotify.docker.client.exceptions.DockerCertificateException; //导入依赖的package包/类
private static void setupCerts(PluginSettings pluginSettings, DefaultDockerClient.Builder builder) throws IOException, DockerCertificateException {
    if (isBlank(pluginSettings.getDockerCACert()) || isBlank(pluginSettings.getDockerClientCert()) || isBlank(pluginSettings.getDockerClientKey())) {
        LOG.warn("Missing docker certificates, will attempt to connect without certificates");
        return;
    }

    Path certificateDir = Files.createTempDirectory(UUID.randomUUID().toString());
    File tempDirectory = certificateDir.toFile();

    try {
        FileUtils.writeStringToFile(new File(tempDirectory, DockerCertificates.DEFAULT_CA_CERT_NAME), pluginSettings.getDockerCACert(), StandardCharsets.UTF_8);
        FileUtils.writeStringToFile(new File(tempDirectory, DockerCertificates.DEFAULT_CLIENT_CERT_NAME), pluginSettings.getDockerClientCert(), StandardCharsets.UTF_8);
        FileUtils.writeStringToFile(new File(tempDirectory, DockerCertificates.DEFAULT_CLIENT_KEY_NAME), pluginSettings.getDockerClientKey(), StandardCharsets.UTF_8);
        builder.dockerCertificates(new DockerCertificates(certificateDir));
    } finally {
        FileUtils.deleteDirectory(tempDirectory);
    }
}
 
开发者ID:gocd-contrib,项目名称:docker-elastic-agents,代码行数:19,代码来源:DockerClientFactory.java

示例2: createClient

import com.spotify.docker.client.exceptions.DockerCertificateException; //导入依赖的package包/类
private DefaultDockerClient createClient() {
    DefaultDockerClient dockerClient;
    Optional<DockerCertificates> certs = Optional.absent();
    if (mccySettings.getDockerCertPath() != null) {
        try {
            certs = DockerCertificates.builder()
                    .dockerCertPath(Paths.get(mccySettings.getDockerCertPath())).build();
        } catch (DockerCertificateException e) {
            throw new IllegalArgumentException("Unable to initialize Docker certificates with given configuration");
        }
    }

    final DefaultDockerClient.Builder clientBuilder = DefaultDockerClient.builder();

    if (certs.isPresent()) {
        clientBuilder
                .dockerCertificates(certs.get());
    }

    dockerClient = clientBuilder
            .uri(mccySettings.getDockerHostUri())
            .build();
    return dockerClient;
}
 
开发者ID:moorkop,项目名称:mccy-engine,代码行数:25,代码来源:DockerClientProxyImpl.java

示例3: countRunningContainers

import com.spotify.docker.client.exceptions.DockerCertificateException; //导入依赖的package包/类
private int countRunningContainers(String imageName) throws DockerException, InterruptedException, DockerCertificateException {
	// The could be a performance hog in huge Docker environments. Replacing with
	// docker labels/metadata is the plan.
	DockerClient dockerClient = null;
	
	try {
		dockerClient = buildDockerClient();
		List<ListContainersParam> params = new ArrayList<ListContainersParam>(2);
		params.add(ListContainersParam.withLabel(DockerLabelsBuilder.CLOUD_NAME, DockerLabelsBuilder.sanitize(getName())));
		if (imageName != null) {
			params.add(ListContainersParam.withLabel(DockerLabelsBuilder.IMAGE_NAME, DockerLabelsBuilder.sanitize(imageName)));
		}
		return dockerClient.listContainers(params.toArray(new ListContainersParam[params.size()])).size();
	} finally {
		if (dockerClient != null) {
			dockerClient.close();
		}
	}
}
 
开发者ID:kmbulebu,项目名称:docker-ephemeral-cloud,代码行数:20,代码来源:DockerCloud.java

示例4: createDockerClient

import com.spotify.docker.client.exceptions.DockerCertificateException; //导入依赖的package包/类
static DockerClient createDockerClient() {
  try {
    return DefaultDockerClient.fromEnv().build();
  } catch (DockerCertificateException e) {
    throw Throwables.propagate(e);
  }
}
 
开发者ID:spotify,项目名称:hype,代码行数:8,代码来源:DockerRunner.java

示例5: LocalEngine

import com.spotify.docker.client.exceptions.DockerCertificateException; //导入依赖的package包/类
public LocalEngine(LocalEngineConfig config) {
    this.config = config;
    try {
        dockerClient = DefaultDockerClient.fromEnv().build();
    } catch (DockerCertificateException e) {
        log.error("initialize dockers client failed: " + e.getMessage(), e);
        throw new RuntimeException("dockers client initialization failed.", e);
    }
}
 
开发者ID:dshell-io,项目名称:dshell,代码行数:10,代码来源:LocalEngine.java

示例6: connect

import com.spotify.docker.client.exceptions.DockerCertificateException; //导入依赖的package包/类
@Override
public DockerHost connect() throws IOException {
    try {
        final DockerHost connected;
        if(this.dockerHost.isEmpty() || this.certPath.isEmpty()) {
            connected = new RtDockerHost(
                DefaultDockerClient.fromEnv().build(),
                this.dockerHost, this.certPath
            );
        } else {
            connected = new RtDockerHost(
                DefaultDockerClient
                    .builder()
                    .uri(this.dockerHost)
                    .dockerCertificates(
                        new DockerCertificates(Paths.get(this.certPath))
                    ).build(),
                this.dockerHost, this.certPath
            );
        }
        return connected;
    } catch (final DockerCertificateException ex) {
        throw new IOException(
            "DockerCertificateException when trying to connect", ex
        );
    }
}
 
开发者ID:amihaiemil,项目名称:comdor,代码行数:28,代码来源:RtDockerHost.java

示例7: createDockerClient

import com.spotify.docker.client.exceptions.DockerCertificateException; //导入依赖的package包/类
protected DockerClient createDockerClient() {
  try {
    return DefaultDockerClient.fromEnv().build();
  } catch (DockerCertificateException e) {
    throw new IllegalStateException("Could not create docker client from environement", e);
  }
}
 
开发者ID:geowarin,项目名称:docker-junit-rule,代码行数:8,代码来源:DockerRule.java

示例8: openDockerClient

import com.spotify.docker.client.exceptions.DockerCertificateException; //导入依赖的package包/类
@Nonnull
private DockerClient openDockerClient() throws MojoExecutionException {
  final RegistryAuthSupplier authSupplier = createRegistryAuthSupplier();

  try {
    return DefaultDockerClient.fromEnv()
        .readTimeoutMillis(readTimeoutMillis)
        .connectTimeoutMillis(connectTimeoutMillis)
        .registryAuthSupplier(authSupplier)
        .build();
  } catch (DockerCertificateException e) {
    throw new MojoExecutionException("Could not load Docker certificates", e);
  }
}
 
开发者ID:spotify,项目名称:dockerfile-maven,代码行数:15,代码来源:AbstractDockerMojo.java

示例9: startPostgresIfNecessary

import com.spotify.docker.client.exceptions.DockerCertificateException; //导入依赖的package包/类
private void startPostgresIfNecessary() {
    try {
        if (container == null) {
            DockerClient docker = DefaultDockerClient.fromEnv().build();
            container = new PostgresContainer(docker, host);
        }
    } catch (DockerCertificateException | InterruptedException | DockerException | IOException | ClassNotFoundException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:alphagov,项目名称:pay-adminusers,代码行数:11,代码来源:PostgresDockerRule.java

示例10: getDockerClient

import com.spotify.docker.client.exceptions.DockerCertificateException; //导入依赖的package包/类
@Bean
public DockerClient getDockerClient() {
	try {
		return DefaultDockerClient.builder()
			.dockerCertificates(DockerCertificates.builder().dockerCertPath(Paths.get(environment.getProperty("shiny.proxy.docker.cert-path", ""))).build().orNull())
			.uri(environment.getProperty("shiny.proxy.docker.url"))
			.build();
	} catch (DockerCertificateException e) {
		throw new ShinyProxyException("Failed to initialize docker client", e);
	}
}
 
开发者ID:openanalytics,项目名称:shinyproxy,代码行数:12,代码来源:DockerService.java

示例11: startPostgresIfNecessary

import com.spotify.docker.client.exceptions.DockerCertificateException; //导入依赖的package包/类
private void startPostgresIfNecessary() {
    try {
        if (container == null) {
            DockerClient docker = DefaultDockerClient.fromEnv().build();
            container = new PostgresContainer(docker, host);
        }
    } catch (InterruptedException | DockerCertificateException | DockerException | IOException | ClassNotFoundException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:alphagov,项目名称:pay-publicauth,代码行数:11,代码来源:PostgresDockerRule.java

示例12: ContainerFactoryImpl

import com.spotify.docker.client.exceptions.DockerCertificateException; //导入依赖的package包/类
@Inject
ContainerFactoryImpl(final UniqueIdService uniqueIdService, final SimpleExecutorService simpleExecutorService)
	throws DockerCertificateException {
	this.uniqueIdService = uniqueIdService;
	this.simpleExecutorService = simpleExecutorService;
	docker = DefaultDockerClient.fromEnv()
		.build();
}
 
开发者ID:coolarch,项目名称:whaleunit,代码行数:9,代码来源:ContainerFactoryImpl.java

示例13: countAllRunningContainers

import com.spotify.docker.client.exceptions.DockerCertificateException; //导入依赖的package包/类
private int countAllRunningContainers() throws DockerException, InterruptedException, DockerCertificateException {
	return countRunningContainers(null);
}
 
开发者ID:kmbulebu,项目名称:docker-ephemeral-cloud,代码行数:4,代码来源:DockerCloud.java

示例14: update

import com.spotify.docker.client.exceptions.DockerCertificateException; //导入依赖的package包/类
@Update
public void update() throws InterruptedException, DockerException, DockerCertificateException, IOException {
    this.stop();
    this.start();
}
 
开发者ID:kevoree,项目名称:kevoree-library,代码行数:6,代码来源:DockerContainer.java

示例15: LocalEngineTest

import com.spotify.docker.client.exceptions.DockerCertificateException; //导入依赖的package包/类
public LocalEngineTest() throws DockerCertificateException {} 
开发者ID:dshell-io,项目名称:dshell,代码行数:2,代码来源:LocalEngineTest.java


注:本文中的com.spotify.docker.client.exceptions.DockerCertificateException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。