Docker: Error: Could not find certificate cert.pem?

Viewed 1282

and thank you in advance for your precious time.

I spent my whole day figuring out what is wrong with my configuration. For all I could gather, here is the issue I am facing.

I Operate on MacOS Catalina 10.15.4, 2.6 GHz 6-Core Intel Core i7.

I used to run the command docker image build -t myContainer . to build my container, and followed by docker run -p 5000:5000 myContainer to run my container. It used to run flawlessly, until I opened the Docker Desktop, and deleted my containers from there. I suspect, the moment I did that, I was able to execute the docker run command, followed by the following error.

Error: Could not find certificate cert.pem

Though, I was able to build my containers successfully.

The step I took to try to tackle with this problem are as follows, but didn't work. These might be helpful to understand the issue more clearly.

  1. I tried to regenerate the certificates for my default machine using docker-machine regenerate-certs default followed by eval $(docker-machine env default). Although it did regenerate my certificates, but still could not solve the error while running the docker run -p 5000:5000 myContainer command.

  2. I restarted my docker machine using docker-machine restart default, still didn't help

  3. I deleted the default machine using docker-machine rm default, and then again created the default machine using `docker-machine create -d virtualbox default'

  4. I deleted and cleaned docker from my system using brew cask uninstall docker and then downloaded the docker.dmg from the website. I restarted my laptop, and started building by container again. build was successful as usual, but it still threw the Error: Could not find certificate cert.pem

  5. I did ssh into default docker machine created symlink for cert.pem from /User/manjot/.docker/machone/machines/default/cert.pem to /var/lib/boot2docker/cert.pem considering the docker was missing the cert.pem in that folder. But still it did not solve the issue.

  6. I also tried to clear the DOCKER_* variables from my environment, and reset them as per the default container using eval $(docker-machine env default).enter image description here

  7. I also override the certificates adding following to daemon.json

{
  "insecure-registries" : ["myregistrydomain.com:5000"]
}

I could not figure out that Where is the docker trying to find the path to the cert.pem?

I also tried to run these commands as sudo. I also removed the containers and default docker machine from user manjotsingh and created a docker using root. But still it did not work

0 Answers
Related