I am attempting to migrate from boot2docker to docker-machine.
I followed the directions here to install docker but I keep getting the following message:
Could not read CA certificate "/Users/<useraccountfolder>/.boot2docker/certs/boot2docker-vm/ca.pem": open /Users/<useraccountfolder>/.boot2docker/certs/boot2docker-vm/ca.pem: no such file or directory
when I run most any docker command.
Docker listens on a socket by default. On Debian and Ubuntu systems using systemd, this means that a host flag -H is always used when starting dockerd. If you specify a hosts entry in the daemon.json, this causes a configuration conflict (as in the above message) and Docker fails to start.
Here first, we need to restart the docker so that it detects the change in OS certificates. Docker has an additional location that we can use to trust individual registry server CA. We place the CA cert inside /etc/docker/certs.d/<docker registry>/ca.crt. Also, we include the port number if we want to specify that in the image tag, e.g.
With this configuration the Docker daemon runs in debug mode, uses TLS, and listens for traffic routed to 192.168.59.3 on port 2376. You can learn what configuration options are available in the dockerd reference docs You can also start the Docker daemon manually and configure it using flags. This can be useful for troubleshooting problems.
If you don’t want to use a system utility to manage the Docker daemon, or just want to test things out, you can manually run it using the dockerd command. You may need to use sudo, depending on your operating system configuration. When you start Docker this way, it runs in the foreground and sends its logs directly to your terminal.
I found my solution here
I needed to update my .bash_profile to look like:
export DOCKER_HOST=tcp://192.168.99.100:2376
export DOCKER_MACHINE_NAME=default
export DOCKER_TLS_VERIFY=1
export DOCKER_CERT_PATH=~/.docker/machine/machines/default
and then run the following to generate the missing ca.pem:
docker-machine regenerate-certs default
I posted this in case this could help anyone else. Thanks/props go to everyone in that thread on github which was found after an hour of pain.
Please follow this guide: Docker for Mac vs Docker Toolbox
Worked for me, you need to unset the variables instead of creating them for mac.
# grep for DOCKER ENV vars
env | grep DOCKER
unset <DOCKER_VARS>
Usually most people have install boot2docker and old version of virtualbox. As said in installation guide, before installing Docker for Mac, we have to uninstall boot2docker and reinstall virtualbox to high version. https://docs.docker.com/engine/installation/mac/#/docker-for-mac
Even though we have installed Docker for Mac, we still encountered error "Could not read CA certificate".
My solution is to remove the docker related environment variables (DOCKER*) from .bash_profile
. It seems a long term solution.
vim ~/.bash_profile
Comment something like DOCKER_*
source ~/.bash_profile
docker info
or docker ps
Hope it helps.
I encountered the same error due to the reason that I had setup the environment to a particular docker machine which I later deleted but my environment was still set to the deleted machine. So docker calls were being redirected the a non-existant machine causing the error.
I unset the environment variables and the issue was fixed:
eval $(docker-machine env -u)
To see which environment variable would be unset run:
docker-machine env -u
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With