Com.github.dockerjava.api.exception.DockerClientException: Certificate path (DOCKER_CERT_PATH) '/root/.docker/certs' doesn't exist

I try to make simple docker-java application on centos 7. Building image and container invocation are successful. This is my codes

public class JavaClient {

public static void main(String[] args) throws Exception {
    // TODO Auto-generated method stub
    DockerClientConfig config = DockerClientConfig.createDefaultConfigBuilder()
    DockerClient dockerClient = DockerClientBuilder.getInstance(config).build();


However I can’t find the docker security files at all. Docker installation, building images and container invocation have no problem. But I don’t know where ssl files in centos 7 are. This is the exception message

Exception in thread “main” com.github.dockerjava.api.exception.DockerClientException: Certificate path (DOCKER_CERT_PATH) ‘/root/.docker/certs’ doesn’t exist.
at com.github.dockerjava.core.DockerClientConfig.checkDockerCertPath(
at com.github.dockerjava.core.DockerClientConfig.(
at com.github.dockerjava.core.DockerClientConfig$

Your advice will be deeply appreciated. Thanks

Is the daemon actually running using tls-related flags? Inspect ps aux | grep docker to see.

If not exposing the Docker API using TLS (which is usually the case when listening on the UNIX socket), you can just skip specifying the Docker cert path since you aren’t using it (so, remove withDockerCertPath line above). Right now you’re trying to tell the Docker client that there are certificates for connection available at /root/.docker/certs, which is a directory that doesn’t exist. Therefore, your client gets confused.