[英]Keep getting Could not read CA certificate when trying to start docker
I am attempting to migrate from boot2docker to docker-machine.我正在尝试从 boot2docker 迁移到 docker-machine。
I followed the directions here to install docker but I keep getting the following message:我按照此处的说明安装 docker,但我不断收到以下消息:
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 命令时。
I found my solution here我在这里找到了我的解决方案
I needed to update my .bash_profile to look like:我需要更新我的 .bash_profile 看起来像:
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:然后运行以下命令来生成缺失的 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.
感谢/道具去 github 上那个线程中的每个人,这是一个小时的痛苦后发现的。
Please follow this guide: Docker for Mac vs Docker Toolbox请遵循本指南: Docker for Mac vs Docker Toolbox
Worked for me, you need to unset the variables instead of creating them for mac.为我工作,您需要取消设置变量而不是为 mac 创建它们。
# grep for DOCKER ENV vars
env | grep DOCKER
unset <DOCKER_VARS>
Usually most people have install boot2docker and old version of virtualbox.通常大多数人都安装了 boot2docker 和旧版本的 virtualbox。 As said in installation guide, before installing Docker for Mac, we have to uninstall boot2docker and reinstall virtualbox to high version.
正如安装指南中所说,在为Mac安装Docker之前,我们必须卸载boot2docker并重新安装virtualbox到高版本。 https://docs.docker.com/engine/installation/mac/#/docker-for-mac
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".即使我们已经为 Mac 安装了 Docker,我们仍然遇到错误“无法读取 CA 证书”。
My solution is to remove the docker related environment variables (DOCKER*) from .bash_profile
.我的解决方案是从
.bash_profile
删除与 docker 相关的环境变量 (DOCKER*)。 It seems a long term solution.这似乎是一个长期的解决方案。
vim ~/.bash_profile
Comment something like DOCKER_*评论类似DOCKER_* 的内容
source ~/.bash_profile
docker info
or docker ps
docker info
或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.我遇到了同样的错误,因为我将环境设置为特定的 docker 机器,后来我删除了该机器,但我的环境仍然设置为已删除的机器。 So docker calls were being redirected the a non-existant machine causing the error.
因此 docker 调用被重定向到导致错误的不存在的机器。
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 the file is present in DOCKER_CERT_PATH
env variable, the error could also be caused due to file permissions issue.如果该文件存在于
DOCKER_CERT_PATH
变量中,则该错误也可能是由于文件权限问题引起的。 Please check this use-case as well.请检查此用例。
My solution in macOS to clean the reference to the missing certs, that were not in ~/.bash_profile
or ~/.bashrc
was:我在MacOS上清洁参考遗漏证书的解决方案,这是不是在
~/.bash_profile
或~/.bashrc
是:
unset ${!DOCKER*}
Source: https://forums.docker.com/t/initial-install-of-docker-for-mac-could-not-read-ca-certificate/9170/7来源: https : //forums.docker.com/t/initial-install-of-docker-for-mac-could-not-read-ca-certificate/9170/7
Docker from the launchpad on my Mac quit working as well as commands from terminal.来自 Mac 上启动板的 Docker 停止工作以及来自终端的命令。 I'm just going to say what I did to fix it for me regardless of whether it makes sense in case it helps someone else out.
我只想说我为我做了什么来修复它,不管它是否有意义,以防它帮助别人。
unset ${!DOCKER*}
unset ${!DOCKER*}
I then ran:然后我跑了:
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/certs/
I then ran: docker
(which only partially worked)然后我跑了:
docker
(它只是部分工作)
unset ${!DOCKER*}
againunset ${!DOCKER*}
If it still doesn't work, run:如果还是不行,运行:
find . -name ca.pem
To find out where it is, and then modify DOCKER_CERT_PATH=<the path you find out>
, and on a Mac, it must be .bash_profile
.要找出它在哪里,然后修改
DOCKER_CERT_PATH=<the path you find out>
,在 Mac 上,它必须是.bash_profile
。 If you input this in yo .oh-my-zsh
it won't work.如果您在 yo
.oh-my-zsh
它,它将不起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.