• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DockerCmdExecFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setupDockerClient

import com.github.dockerjava.api.command.DockerCmdExecFactory; //导入依赖的package包/类
private void setupDockerClient() throws
    InvalidCredentialsException {
  if (dockerClient != null) {
    return;
  }

  final DockerClientConfig config = createClientConfig();

  final DockerCmdExecFactory dockerCmdExecFactory = new JerseyDockerCmdExecFactory();
  dockerClient = DockerClientBuilder.getInstance(config)
      .withDockerCmdExecFactory(dockerCmdExecFactory)
      .build();

  // Check if client was successfully created
  final AuthResponse response = dockerClient.authCmd().exec();
  if (!response.getStatus().equalsIgnoreCase("Login Succeeded")) {
    throw new InvalidCredentialsException("Could not create DockerClient");
  }
}
 
开发者ID:tsiq,项目名称:magic-beanstalk,代码行数:20,代码来源:DockerClientManagerWithAuth.java


示例2: createDockerClient

import com.github.dockerjava.api.command.DockerCmdExecFactory; //导入依赖的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


示例3: testConcurrentClientBuilding

import com.github.dockerjava.api.command.DockerCmdExecFactory; //导入依赖的package包/类
@Test
public void testConcurrentClientBuilding() throws Exception {
    // we use it to check instance uniqueness
    final Set<DockerCmdExecFactory> instances = Collections.synchronizedSet(new HashSet<DockerCmdExecFactory>());

    Runnable runnable = new Runnable() {
        @Override
        public void run() {
            DockerCmdExecFactory factory = DockerClientBuilder.getDefaultDockerCmdExecFactory();
            // factory created
            assertNotNull(factory);
            // and is unique
            assertFalse(instances.contains(factory));
            instances.add(factory);
        }
    };

    parallel(AMOUNT, runnable);
    // set contains all required unique instances
    assertEquals(instances.size(), AMOUNT);
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:22,代码来源:DockerClientBuilderTest.java


示例4: get

import com.github.dockerjava.api.command.DockerCmdExecFactory; //导入依赖的package包/类
@SuppressWarnings("resource")
@Override
public DockerCmdExecFactory get() {
  JerseyDockerCmdExecFactory factory = new JerseyDockerCmdExecFactory()
      .withMaxTotalConnections(config.getMaxTotalConnections())
      .withMaxPerRouteConnections(config.getMaxPerRouteConnections())
      .withClientRequestFilters(config.getClientRequestFilters())
      .withClientResponseFilters(config.getClientResponseFilters());

  config.getReadTimeout().ifPresent(value -> factory.withReadTimeout(value));
  config.getConnectTimeout().ifPresent(value -> factory.withConnectTimeout(value));
  config.getConnectionRequestTimeout().ifPresent(value -> factory.withConnectionRequestTimeout(value));

  return factory;
}
 
开发者ID:Qorr,项目名称:Hvalspik,代码行数:16,代码来源:DockerCmdExecFactoryProvider.java


示例5: getDockerClient

import com.github.dockerjava.api.command.DockerCmdExecFactory; //导入依赖的package包/类
@Bean
	public DockerClient getDockerClient () {
		logger.info( "Creating pooled docker: {} ", docker.toString() );

		DockerClient client = null;
		try {
			DockerClientConfig config = DefaultDockerClientConfig.createDefaultConfigBuilder()
				.withDockerHost( docker.getUrl() )
				.build();

			DockerCmdExecFactory dockerCmdExecFactory = new JerseyDockerCmdExecFactory()
				.withReadTimeout( docker.getReadTimeoutSeconds() *1000 )
				.withConnectTimeout( docker.getConnectionTimeoutSeconds() *1000  )
				.withMaxTotalConnections( docker.getConnectionPool() )
				.withMaxPerRouteConnections( 3 );
			
//			DockerCmdExecFactory dockerCmdExecFactory = new NettyDockerCmdExecFactory()
//					.withConnectTimeout( docker.getReadTimeoutSeconds() *1000 ) ;

			client = DockerClientBuilder
				.getInstance( config )
				.withDockerCmdExecFactory( dockerCmdExecFactory )
				.build();

			// client = DefaultDockerClient.builder()
			// .uri( docker.getUrl() )
			// .connectionPoolSize( docker.getConnectionPool() )
			// .build();
		} catch (Throwable t) {
			logger.warn( "Failed connecting to docker: {}", CSAP.getCsapFilteredStackTrace( t ) );
		}

		return client;
	}
 
开发者ID:csap-platform,项目名称:csap-core,代码行数:35,代码来源:CsapCoreService.java


示例6: configure

import com.github.dockerjava.api.command.DockerCmdExecFactory; //导入依赖的package包/类
@Override
protected void configure() {
  requireBinding(Config.class);

  bind(DockerCmdExecFactory.class).toProvider(DockerCmdExecFactoryProvider.class).in(Singleton.class);
  bind(DockerClient.class).toProvider(DockerClientProvider.class).in(Singleton.class);
  bind(DockerHostProvider.class).in(Singleton.class);
  bind(DockerHost.class).toProvider(DockerHostProvider.class);

  bind(DockerFacade.class).to(DockerFacadeImpl.class);
  bind(ContainerFacade.class).to(ContainerFacadeImpl.class);
  bind(ImageFacade.class).to(ImageFacadeImpl.class);
  bind(InfoFacade.class).to(InfoFacadeImpl.class);
  bind(NetworkingFacade.class).to(NetworkFacadeImpl.class);
}
 
开发者ID:Qorr,项目名称:Hvalspik,代码行数:16,代码来源:DockerClientModule.java


示例7: DockerClientFactory

import com.github.dockerjava.api.command.DockerCmdExecFactory; //导入依赖的package包/类
@Inject
protected DockerClientFactory(DockerCmdExecFactory cmdExecFactory) {
  super();
  this.cmdExecFactory = cmdExecFactory;
}
 
开发者ID:Qorr,项目名称:Hvalspik,代码行数:6,代码来源:DockerClientFactory.java


示例8: withDockerCmdExecFactory

import com.github.dockerjava.api.command.DockerCmdExecFactory; //导入依赖的package包/类
public DockerClientImpl withDockerCmdExecFactory(DockerCmdExecFactory dockerCmdExecFactory) {
    checkNotNull(dockerCmdExecFactory, "dockerCmdExecFactory was not specified");
    this.dockerCmdExecFactory = dockerCmdExecFactory;
    this.dockerCmdExecFactory.init(dockerClientConfig);
    return this;
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:7,代码来源:DockerClientImpl.java


示例9: getDockerCmdExecFactory

import com.github.dockerjava.api.command.DockerCmdExecFactory; //导入依赖的package包/类
private DockerCmdExecFactory getDockerCmdExecFactory() {
    checkNotNull(dockerCmdExecFactory, "dockerCmdExecFactory was not specified");
    return dockerCmdExecFactory;
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:5,代码来源:DockerClientImpl.java


示例10: getDefaultDockerCmdExecFactory

import com.github.dockerjava.api.command.DockerCmdExecFactory; //导入依赖的package包/类
public static DockerCmdExecFactory getDefaultDockerCmdExecFactory() {
    return new JerseyDockerCmdExecFactory();
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:4,代码来源:DockerClientBuilder.java


示例11: withDockerCmdExecFactory

import com.github.dockerjava.api.command.DockerCmdExecFactory; //导入依赖的package包/类
public DockerClientBuilder withDockerCmdExecFactory(DockerCmdExecFactory dockerCmdExecFactory) {
    this.dockerCmdExecFactory = dockerCmdExecFactory;
    return this;
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:5,代码来源:DockerClientBuilder.java


示例12: TestDockerCmdExecFactory

import com.github.dockerjava.api.command.DockerCmdExecFactory; //导入依赖的package包/类
public TestDockerCmdExecFactory(DockerCmdExecFactory delegate) {
    this.delegate = delegate;
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:4,代码来源:TestDockerCmdExecFactory.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AnnotationScopeMetadataResolver类代码示例发布时间:2022-05-22
下一篇:
Java NetConnection类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap