简体   繁体   English

尝试启动docker时不断获取无法读取CA证书

[英]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.这似乎是一个长期的解决方案。

  1. vim ~/.bash_profile

  2. Comment something like DOCKER_*评论类似DOCKER_* 的内容

  3. source ~/.bash_profile

  4. relaunch the terminal, you should have no problem on running : docker info or docker ps重新启动终端,运行应该没有问题: docker infodocker 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.我只想说我为我做了什么来修复它,不管它是否有意义,以防它帮助别人。

  • I ran 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 (它只是部分工作)

  • then I ran: unset ${!DOCKER*} again然后我再次运行: unset ${!DOCKER*}
  • Then I launched docker from the Launchpad, gave it a minute and now it's running again and everything is back to normal.然后我从 Launchpad 启动了 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.

相关问题 Docker:无法读取 CA 证书:没有这样的文件或目录 - Docker: Could not read CA certificate: no such file or directory 运行sbt时在Mac上出现“无法启动流”错误 - Getting “Could not start stream” error on Mac when running sbt 尝试使用 Mac 在 Eclipse 上运行 Javafx 时不断出错 - Keep Getting Error When Trying to Run Javafx on Eclipse with Mac 当我在 react app 上执行 npm start 时,不断收到“?端口 3000 上已经有东西在运行” - keep getting "? Something is already running on port 3000" when I do npm start on react app 为什么在 MacOS 上尝试使用 Python 3 创建虚拟环境时总是出现此错误? - Why do I keep getting this error when trying to create a virtual environment with Python 3 on MacOS? 为什么在 Mac 上尝试安装“pip install ball”时总是出现错误 - Why do I keep getting an error when trying to install "pip install ball" on Mac 尝试在 Netbeans 上运行 JavaFx 项目时,为什么我在 MacOS 上不断收到此 SIGBUS 错误代码? - Why do I keep getting this SIGBUS error code on my MacOS when trying to run a JavaFx Project on Netbeans? 尝试在macOS上启动现有项目时获取“找不到ApplicationHost.cs文件” - Getting “ApplicationHost.cs file not found” when trying to start existing project on macOS 将XAMPP文件夹移动到新计算机,在尝试启动MySQL时现在得到“(XAMPPErrorDomain错误1.)” - Moved XAMPP folder to new computer, now getting “(XAMPPErrorDomain error 1.)” when trying to start up MySQL 无法启动phpMyAdmin。 继续得到#2002套接字错误 - Can't start phpMyAdmin. Keep getting the #2002 socket error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM