com.github.dockerjava.core.SSLConfig Java Examples
The following examples show how to use
com.github.dockerjava.core.SSLConfig.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DockerAPI.java From docker-plugin with MIT License | 6 votes |
/** * 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 String socketFileName = uri.getPath(); final AFUNIXSocketAddress unix = new AFUNIXSocketAddress(new File(socketFileName)); 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()); } return new Socket(uri.getHost(), uri.getPort()); } catch (Exception e) { throw new IOException("Failed to create a Socker for docker URI " + dockerHost.getUri(), e); } }
Example #2
Source File: DockerSwarmCloud.java From docker-swarm-plugin with MIT License | 5 votes |
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); }
Example #3
Source File: DockerSwarmCloud.java From docker-swarm-plugin with MIT License | 5 votes |
public SSLContext getSSLContext() throws IOException { try { final SSLConfig sslConfig = toSSlConfig(dockerHost.getCredentialsId()); if (sslConfig != null) { return sslConfig.getSSLContext(); } } catch (Exception e) { throw new IOException("Failed to create SSL Config ", e); } return null; }
Example #4
Source File: DockerAPI.java From docker-plugin with MIT License | 5 votes |
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); }