简体   繁体   English

为什么 Colima 找不到 Docker 守护进程

[英]Why does Colima failed to find Docker daemon

I was using Docker Desktop on my Mac for a long time.我在 Mac 上使用 Docker Desktop 很长时间了。 Currently Docker desktop causing a huge issues related to starting up.当前 Docker 桌面导致与启动相关的巨大问题。 Everytime it needs some tweak to run or uninstall and install it again, that takes several hours to fix every time I start working.每次需要进行一些调整才能运行或卸载并重新安装时,每次我开始工作时都需要几个小时才能修复。

So I started using other Docker Desktop alternative for mac that is Colima ( Co ntainer on Li nux on Ma c) installed with the help of the Git link.因此,我开始使用其他Docker Mac 桌面替代品,即在Git链接的帮助下安装的 Colima(Mac 上的Li nux 上的 Container)。

And I am using Docker client for Docker runtime by installing it using: brew install docker and I have logged in using docker login via terminal.我正在使用 Docker 客户端安装 Docker 运行时: brew install docker并且我已经使用docker login

The important note here is that all the above configuration works well with Docker Desktop but after uninstalling everything related to docker and start using Colima .这里要注意的是,以上所有配置都适用于 Docker 桌面,但在卸载与 docker 相关的所有内容并开始使用Colima之后。

While I run docker info I got the following message:当我运行docker info时,我收到以下消息:

$ docker info
Client:
 Context:    default
 Debug Mode: false

Server:
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
errors pretty printing info

Here are few other information that might need:以下是可能需要的其他一些信息:

$ colima version
colima version 0.4.2
git commit: f112f336d05926d62eb6134ee3d00f206560493b

runtime: docker
arch: x86_64
client: v20.10.17
server: v20.10.11

kubernetes
Client Version: v1.24.1
Kustomize Version: v4.5.4
Server Version: v1.23.6+k3s1

Operating System: macOS Monterey Version: 12.3.1 (21E258)操作系统:macOS Monterey 版本:12.3.1 (21E258)

Any help would be highly appreciated.任何帮助将不胜感激。

After posting the question on StackOverflow I was non stop searching for a solution.在 StackOverflow 上发布问题后,我一直在寻找解决方案。 Finally it took a day to fixed it (for me).最后花了一天时间来修复它(对我来说)。 While searching on google I have found a solution in this link .在谷歌上搜索时, 我在此链接中找到了解决方案

Basically Colima usage $HOME/.colima/docker.sock , so first I checked if there is anything in the ~/.colima by running ls -la ~/.colima and I have found that docker.sock is there.基本上Colima使用$HOME/.colima/docker.sock ,所以首先我通过运行ls -la ~/.colima检查~/.colima中是否有任何东西,我发现docker.sock在那里。

So I set up the DOCKER_HOST by running the following command:所以我通过运行以下命令来设置 DOCKER_HOST:

$ export DOCKER_HOST="unix://$HOME/.colima/docker.sock"

and then run:然后运行:

$ docker info

Now it shows everything related to Docker Server :)现在它显示了与 Docker Server 相关的所有内容:)

Client:
 Context:    default
 Debug Mode: false

Server:
 Containers: 29
  Running: 19
  Paused: 0
  Stopped: 10
 Images: 19
 Server Version: 20.10.11
 .....

I have same problem, because i start colima before install docker, i run我有同样的问题,因为我在安装 docker 之前启动了 colima,我运行

$ colima delete
$ colima start

terminal print:终端打印:

INFO[0000] starting colima                             
INFO[0000] runtime: docker

and colima docker worked!科利马 docker 成功了!

Best is to add docker-host in .zshrc file最好是在.zshrc文件中添加docker-host

export DOCKER_HOST="unix://$HOME/.colima/docker.sock"

Note that in case you uninstall colima, then again install docker-desktop, then just comment above line of .zshrc file请注意,如果您卸载 colima,然后再次安装.zshrc -desktop,然后只需在 .zshrc 文件的行上方注释

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM