18

I was using Docker Desktop on my Mac for a long time. Currently Docker desktop causing a huge issues related to starting up. 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 (Container on Linux on Mac) installed with the help of the Git link.

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.

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.

While I run docker info I got the following message:

$ 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)

Any help would be highly appreciated.

Siddiqui Noor
  • 5,575
  • 5
  • 25
  • 41

4 Answers4

36

After posting the question on StackOverflow I was non stop searching for a solution. 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.

So I set up the DOCKER_HOST by running the following command:

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

and then run:

$ docker info

Now it shows everything related to Docker Server :)

Client:
 Context:    default
 Debug Mode: false

Server:
 Containers: 29
  Running: 19
  Paused: 0
  Stopped: 10
 Images: 19
 Server Version: 20.10.11
 .....
Siddiqui Noor
  • 5,575
  • 5
  • 25
  • 41
  • 7
    The normal technique (documented in colima docs) is `docker context use colima`, which points your docker context to colima. Or `docker context use default` to go back to docker. You can actually have both running at the same time. – rfay Jun 24 '22 at 14:44
  • It was not working for me saying "Current context "colima" is not found on the file system, please check your config file". – Siddiqui Noor Jul 23 '22 at 09:22
  • 1
    Colima for the last year or so has created a docker context when you `colima start`. You can use `docker context ls` to show the currently available contexts. I would `docker context rm colima` and then `colima start` to let colima create it again. – rfay Jul 23 '22 at 19:06
  • `docker context ls` gives me this result: "Current context "colima" is not found on the file system, please check your config file at /Users/someuser/.docker/config.json" – Siddiqui Noor Jul 25 '22 at 06:28
  • Have you tried `docker context use default` first, to switch, or does it give you the same problem? Bottom line is that your .docker/config.json has invalid information in it. You can manually edit it, or even delete it. I'd probably start with `mv .docker/config.json .docker/config.json.bak` and then see how things went. – rfay Jul 25 '22 at 22:26
22

I have same problem, because i start colima before install docker, i run

$ colima delete
$ colima start

terminal print:

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

and colima docker worked!

Gengjin
  • 221
  • 1
  • 3
4

Best is to add docker-host in .zshrc file

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

Akshay Vijay Jain
  • 13,461
  • 8
  • 60
  • 73
0

I haved the same issue and the error persisted after colima delete, then i use colima start --edit and change the runtime to docker

# Container runtime to be used (docker, containerd).
# Default: docker
runtime: docker