mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Try to fix problems caused by stricter config checking in docker-java 3.0
Previously, the launch script integration tests ran happily on OS X and on Bamboo’s Linux instances. With the upgrade to docker-java 3.0 that is no longer the case with the default DockerClientConfig failing on Bamboo as the default DOCKER_CERT_PATH location does not exist. This commit updates the client configuration so that it attempts to build the configuration once in it default configuration and, if this fails, it tries again without TLS verification. This skips the check of DOCKER_CERT_PATH’s validity.
This commit is contained in:
parent
813d86e5e0
commit
2ecb33f7b4
@ -23,9 +23,11 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.github.dockerjava.api.DockerClient;
|
||||
import com.github.dockerjava.api.exception.DockerClientException;
|
||||
import com.github.dockerjava.api.model.Frame;
|
||||
import com.github.dockerjava.core.DockerClientBuilder;
|
||||
import com.github.dockerjava.core.DockerClientConfig;
|
||||
import com.github.dockerjava.core.DockerClientConfig.DockerClientConfigBuilder;
|
||||
import com.github.dockerjava.core.command.AttachContainerResultCallback;
|
||||
import com.github.dockerjava.core.command.BuildImageResultCallback;
|
||||
import com.github.dockerjava.core.command.WaitContainerResultCallback;
|
||||
@ -219,10 +221,16 @@ public class SysVinitLaunchScriptIT {
|
||||
}
|
||||
|
||||
private DockerClient createClient() {
|
||||
DockerClientConfig config = DockerClientConfig.createDefaultConfigBuilder()
|
||||
.build();
|
||||
DockerClient docker = DockerClientBuilder.getInstance(config).build();
|
||||
return docker;
|
||||
DockerClientConfigBuilder builder = DockerClientConfig
|
||||
.createDefaultConfigBuilder();
|
||||
DockerClientConfig config;
|
||||
try {
|
||||
config = builder.build();
|
||||
}
|
||||
catch (DockerClientException ex) {
|
||||
config = builder.withDockerTlsVerify(false).build();
|
||||
}
|
||||
return DockerClientBuilder.getInstance(config).build();
|
||||
}
|
||||
|
||||
private String buildImage(DockerClient docker) {
|
||||
|
Loading…
Reference in New Issue
Block a user