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


Java DockerClientConfig.DockerClientConfigBuilder方法代码示例

本文整理汇总了Java中com.github.dockerjava.core.DockerClientConfig.DockerClientConfigBuilder方法的典型用法代码示例。如果您正苦于以下问题:Java DockerClientConfig.DockerClientConfigBuilder方法的具体用法?Java DockerClientConfig.DockerClientConfigBuilder怎么用?Java DockerClientConfig.DockerClientConfigBuilder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.github.dockerjava.core.DockerClientConfig的用法示例。


在下文中一共展示了DockerClientConfig.DockerClientConfigBuilder方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import com.github.dockerjava.core.DockerClientConfig; //导入方法依赖的package包/类
public void init() {
	if (dc == null) {
		DockerClientConfig.DockerClientConfigBuilder builder = DockerClientConfig.createDefaultConfigBuilder();

           DockerClientConfig config = builder.build();
           dc = DockerClientBuilder.getInstance(config).build();

           dc.pullImageCmd(imageName).withTag(imageVersion).exec(new PullImageResultCallback()).awaitSuccess();
	}
	if (dockerPool == null) {
		dockerPool = Executors.newFixedThreadPool(poolSize);
	}
}
 
开发者ID:microservices-demo,项目名称:queue-master,代码行数:14,代码来源:DockerSpawner.java

示例2: run

import com.github.dockerjava.core.DockerClientConfig; //导入方法依赖的package包/类
private void run() throws Exception {
    Runtime.getRuntime().addShutdownHook(new Thread(cluster::stop));
    cluster.start();

    DockerClientConfig.DockerClientConfigBuilder dockerConfigBuilder = DockerClientConfig
        .createDefaultConfigBuilder()
        .withUri("http://" + cluster.getMesosContainer().getIpAddress() + ":" + DOCKER_PORT);
    DockerClient clusterDockerClient = DockerClientBuilder
        .getInstance(dockerConfigBuilder.build()).build();

    cluster.injectImage("mesos/logstash-executor");

    DummyFrameworkContainer dummyFrameworkContainer = new DummyFrameworkContainer(
        clusterDockerClient, "dummy-framework");
    dummyFrameworkContainer.start();

    String zkAddress = cluster.getMesosContainer().getIpAddress() + ":2181";

    System.setProperty("mesos.master.uri", "zk://" + zkAddress + "/mesos");
    System.setProperty("mesos.logstash.state.zk", zkAddress);
    System.setProperty("mesos.logstash.logstash.heap.size", "128");
    System.setProperty("mesos.logstash.executor.heap.size", "64");

    System.out.println("");
    System.out.println("Cluster Started.");
    System.out.println("MASTER URL: " + cluster.getMesosContainer().getMesosMasterURL());
    System.out.println("");

    while (!Thread.currentThread().isInterrupted()) {
        Thread.sleep(5000);
        printRunningContainers();
    }
}
 
开发者ID:triforkse,项目名称:logstash-mesos,代码行数:34,代码来源:LocalCluster.java

示例3: getMesosClusterDockerClient

import com.github.dockerjava.core.DockerClientConfig; //导入方法依赖的package包/类
@BeforeClass
public static void getMesosClusterDockerClient() {
    DockerClientConfig.DockerClientConfigBuilder dockerConfigBuilder = DockerClientConfig
        .createDefaultConfigBuilder()
        .withUri("http://" + cluster.getMesosContainer().getIpAddress() + ":" + DOCKER_PORT);
    clusterDockerClient = DockerClientBuilder.getInstance(dockerConfigBuilder.build()).build();
}
 
开发者ID:triforkse,项目名称:logstash-mesos,代码行数:8,代码来源:AbstractLogstashFrameworkTest.java

示例4: run

import com.github.dockerjava.core.DockerClientConfig; //导入方法依赖的package包/类
private void run() throws Exception {

        Runtime.getRuntime().addShutdownHook(new Thread(cluster::stop));
        cluster.start();

        MesosMaster master = cluster.getMasterContainer();

        DockerClientConfig.DockerClientConfigBuilder dockerConfigBuilder = DockerClientConfig
            .createDefaultConfigBuilder()
            .withUri("http://" + master.getIpAddress() + ":" + DOCKER_PORT);
        DockerClient clusterDockerClient = DockerClientBuilder
            .getInstance(dockerConfigBuilder.build()).build();

        DummyFrameworkContainer dummyFrameworkContainer = new DummyFrameworkContainer(
            clusterDockerClient, "dummy-framework");
        dummyFrameworkContainer.start(ClusterConfig.DEFAULT_TIMEOUT_SECS);

        String mesosZk = master.getFormattedZKAddress();

        System.setProperty("mesos.zk", mesosZk);
        System.setProperty("mesos.logstash.logstash.heap.size", "128");
        System.setProperty("mesos.logstash.executor.heap.size", "64");

        System.out.println("");
        System.out.println("Cluster Started.");
        System.out.println("MASTER URL: " + master.getFormattedZKAddress());
        System.out.println("");

        while (!Thread.currentThread().isInterrupted()) {
            Thread.sleep(5000);
            printRunningContainers(clusterDockerClient);
        }
    }
 
开发者ID:mesos,项目名称:logstash,代码行数:34,代码来源:LocalCluster.java

示例5: connectToLocalDocker

import com.github.dockerjava.core.DockerClientConfig; //导入方法依赖的package包/类
/**
 * Creates and connects to a local Docker client.
 */
public void connectToLocalDocker() {
	DockerClientConfig.DockerClientConfigBuilder b = DockerClientConfig.createDefaultConfigBuilder();
	LOG.info(b.toString());
	dockerClient = DockerClientBuilder.getInstance(b.build()).build();
	LOG.info("connected to: " + dockerClient.toString());
}
 
开发者ID:DePaul2015SEStudioTeam1,项目名称:agent,代码行数:10,代码来源:LocalDockerService.java

示例6: start

import com.github.dockerjava.core.DockerClientConfig; //导入方法依赖的package包/类
/**
 * Starts the bridge.
 *
 * @param vertx         the vert.x instance
 * @param publisher     the service discovery instance
 * @param configuration the bridge configuration if any
 * @param completion    future to assign with completion status
 */
@Override
public void start(Vertx vertx, ServicePublisher publisher, JsonObject configuration, Future<Void> completion) {
  this.publisher = publisher;
  this.vertx = vertx;
  DockerClientConfig.DockerClientConfigBuilder builder =
      DockerClientConfig.createDefaultConfigBuilder();
  String dockerCertPath = configuration.getString("docker-cert-path");
  String dockerCfgPath = configuration.getString("docker-cfg-path");
  String email = configuration.getString("docker-registry-email");
  String password = configuration.getString("docker-registry-password");
  String username = configuration.getString("docker-registry-username");
  String host = configuration.getString("docker-host");
  boolean tlsVerify = configuration.getBoolean("docker-tls-verify", true);
  String registry
      = configuration.getString("docker-registry-url", "https://index.docker.io/v1/");
  String version = configuration.getString("version");

  if (dockerCertPath != null) {
    builder.withDockerCertPath(dockerCertPath);
  }
  if (dockerCfgPath != null) {
    builder.withDockerConfig(dockerCfgPath);
  }
  if (email != null) {
    builder.withRegistryEmail(email);
  }
  if (password != null) {
    builder.withRegistryPassword(password);
  }
  if (username != null) {
    builder.withRegistryUsername(username);
  }
  if (host != null) {
    builder.withDockerHost(host);
  }
  if (registry != null) {
    builder.withRegistryUrl(registry);
  }
  if (version != null) {
    builder.withApiVersion(version);
  }
  builder.withDockerTlsVerify(tlsVerify);


  DockerClientConfig config = builder.build();
  if (config.getDockerHost().getScheme().equalsIgnoreCase("unix")) {
    try {
      this.host = InetAddress.getLocalHost().getHostAddress();
    } catch (UnknownHostException e) {
      completion.fail(e);
    }
  } else {
    this.host = config.getDockerHost().getHost();
  }
  client = DockerClientBuilder.getInstance(config).build();

  long period = configuration.getLong("scan-period", 3000L);
  if (period > 0) {
    timer = vertx.setPeriodic(period, l -> {
      scan(null);
    });
  }
  scan(completion);
}
 
开发者ID:vert-x3,项目名称:vertx-service-discovery,代码行数:73,代码来源:DockerServiceImporter.java


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