macosdockercertificate

Docker: Could not read CA certificate: no such file or directory


I'm on OSX and I've used docker-machine before, but now that there is a native Docker for Mac I wanted to install that. So I uninstalled docker-machine using this uninstall script, and then I installed and started Docker for Mac without a problem.

I can run docker --help, which shows me all options as expected.

When I run docker ps however, I get the following:

$ docker ps Could not read CA certificate "/Users/kramer65/.docker/machine/machines/default/ca.pem": open /Users/kramer65/.docker/machine/machines/default/ca.pem: no such file or directory

I tried the solution from this answer (including sourcing the .bash_profile to activate it), but that didn't solve anything.

Does anybody know what I can do to solve this?


Solution

  • Please remove your old docker-machine

    docker-machine rm default
    

    then, edit your .bashrc .profile or .zshrc (whatever you use) and remove anything that exports DOCKER env variables (like socket, host, port and so on).

    Restart your shell at least, you can restart your Mac. When you do

    env | grep DOCKER
    

    You should see nothing. docker ps should now work flawlessly.

    Background: The problem is that the old dockertoolbox defines a custom host/port and puts that into your bashrc and does not remove it after uninstallation.

    docker for mac uses the Unix default socket, but it will not get picked up until you remove those old ENV variables