本文整理汇总了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);
}
}
示例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();
}
}
示例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();
}
示例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);
}
}
示例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());
}
示例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);
}