Browse Source

update DockerImpl

reghao 1 year ago
parent
commit
85cebd4680
1 changed files with 5 additions and 4 deletions
  1. 5 4
      common/src/main/java/cn/reghao/bnt/common/docker/DockerImpl.java

+ 5 - 4
common/src/main/java/cn/reghao/bnt/common/docker/DockerImpl.java

@@ -31,12 +31,13 @@ import java.util.stream.Collectors;
 public class DockerImpl implements Docker {
     private DockerClient dockerClient;
     private final TextFile textFile = new TextFile();
+    private final String unixSock = "/var/run/docker.sock";
 
     public DockerImpl() {
         DockerClientConfig config = DefaultDockerClientConfig.createDefaultConfigBuilder()
-                .withDockerHost("unix:///var/run/docker.sock")
+                .withDockerHost("unix://" + unixSock)
                 .withDockerTlsVerify(false)
-                .withDockerCertPath(String.format("%s/.docker", System.getProperty("user.home")))
+                //.withDockerCertPath(String.format("%s/.docker", System.getProperty("user.home")))
                 //.withRegistryUsername("username")
                 //.withRegistryPassword("password")
                 //.withRegistryEmail(registryMail)
@@ -47,9 +48,9 @@ public class DockerImpl implements Docker {
 
     public DockerImpl(String username, String password) {
         DockerClientConfig config = DefaultDockerClientConfig.createDefaultConfigBuilder()
-                .withDockerHost("unix:///var/run/docker.sock")
+                .withDockerHost("unix://" + unixSock)
                 .withDockerTlsVerify(false)
-                .withDockerCertPath(String.format("%s/.docker", System.getProperty("user.home")))
+                //.withDockerCertPath(String.format("%s/.docker", System.getProperty("user.home")))
                 .withRegistryUsername("username")
                 .withRegistryPassword("password")
                 //.withRegistryEmail(registryMail)