本文整理汇总了Java中com.github.dockerjava.core.SSLConfig类的典型用法代码示例。如果您正苦于以下问题:Java SSLConfig类的具体用法?Java SSLConfig怎么用?Java SSLConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SSLConfig类属于com.github.dockerjava.core包,在下文中一共展示了SSLConfig类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createDockerClient
import com.github.dockerjava.core.SSLConfig; //导入依赖的package包/类
private static DockerClient createDockerClient(String dockerUrl, String dockerVersion, String dockerCertPath,
AuthConfig authConfig) {
// TODO JENKINS-26512
SSLConfig dummySSLConf = (new SSLConfig() {
public SSLContext getSSLContext() throws KeyManagementException, UnrecoverableKeyException,
NoSuchAlgorithmException, KeyStoreException {
return null;
}
});
if (dockerCertPath != null) {
dummySSLConf = new LocalDirectorySSLConfig(dockerCertPath);
}
DefaultDockerClientConfig.Builder configBuilder = new DefaultDockerClientConfig.Builder().withDockerHost(dockerUrl)
.withApiVersion(dockerVersion).withCustomSslConfig(dummySSLConf);
if (authConfig != null) {
configBuilder.withRegistryUsername(authConfig.getUsername())
.withRegistryEmail(authConfig.getEmail())
.withRegistryPassword(authConfig.getPassword())
.withRegistryUrl(authConfig.getRegistryAddress());
}
// using jaxrs/jersey implementation here (netty impl is also available)
DockerCmdExecFactory dockerCmdExecFactory = new DockerCmdExecFactoryImpl()
.withConnectTimeout(1000)
.withMaxTotalConnections(1)
.withMaxPerRouteConnections(1);
return DockerClientBuilder.getInstance(configBuilder).withDockerCmdExecFactory(dockerCmdExecFactory).build();
}
开发者ID:jenkinsci,项目名称:docker-build-step-plugin,代码行数:30,代码来源:DockerBuilder.java
示例2: getSocket
import com.github.dockerjava.core.SSLConfig; //导入依赖的package包/类
/**
* Create a plain {@link Socket} to docker API endpoint
*/
public Socket getSocket() throws IOException {
try {
final URI uri = new URI(dockerHost.getUri());
if ("unix".equals(uri.getScheme())) {
final AFUNIXSocketAddress unix = new AFUNIXSocketAddress(new File("/var/run/docker.sock"));
final Socket socket = AFUNIXSocket.newInstance();
socket.connect(unix);
return socket;
}
final SSLConfig sslConfig = toSSlConfig(dockerHost.getCredentialsId());
if (sslConfig != null) {
return sslConfig.getSSLContext().getSocketFactory().createSocket(uri.getHost(), uri.getPort());
} else {
return new Socket(uri.getHost(), uri.getPort());
}
} catch (Exception e) {
throw new IOException("Failed to create a Socker for docker URI " + dockerHost.getUri(), e);
}
}
开发者ID:jenkinsci,项目名称:docker-plugin,代码行数:24,代码来源:DockerAPI.java
示例3: toSSlConfig
import com.github.dockerjava.core.SSLConfig; //导入依赖的package包/类
private static SSLConfig toSSlConfig(String credentialsId) {
if (credentialsId == null) return null;
DockerServerCredentials credentials = firstOrNull(
lookupCredentials(
DockerServerCredentials.class,
Jenkins.getInstance(),
ACL.SYSTEM,
Collections.<DomainRequirement>emptyList()),
withId(credentialsId));
return credentials == null ? null :
new DockerServerCredentialsSSLConfig(credentials);
}
开发者ID:jenkinsci,项目名称:docker-plugin,代码行数:14,代码来源:DockerAPI.java
注:本文中的com.github.dockerjava.core.SSLConfig类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论