|
|
@@ -9,6 +9,7 @@ import com.spotify.docker.client.exceptions.DockerException;
|
|
|
import com.spotify.docker.client.messages.Image;
|
|
|
import com.spotify.docker.client.messages.ProgressMessage;
|
|
|
import lombok.extern.apachecommons.CommonsLog;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.boot.system.ApplicationHome;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
@@ -27,6 +28,7 @@ import java.util.List;
|
|
|
|
|
|
@Component
|
|
|
@CommonsLog
|
|
|
+@Slf4j
|
|
|
public class DockerApiImpl implements DockerApi {
|
|
|
|
|
|
private final DockerClient client;
|
|
|
@@ -42,8 +44,10 @@ public class DockerApiImpl implements DockerApi {
|
|
|
dockerConfigPath = ResourceUtils.getFile("classpath:docker").toPath();
|
|
|
if (properties.getDocker().getTls()){
|
|
|
client = new DefaultDockerClient(URI.create(properties.getDocker().getHost()), new DockerCertificates(dockerConfigPath));
|
|
|
+ log.info("Docker 启用tls验证");
|
|
|
} else {
|
|
|
client = new DefaultDockerClient(properties.getDocker().getHost());
|
|
|
+ log.info("Docker 未启用tls验证");
|
|
|
}
|
|
|
} catch (FileNotFoundException e) {
|
|
|
throw new DockerCertificateException("设置读取失败");
|