colima icon indicating copy to clipboard operation
colima copied to clipboard

No easy way to configure Colima to use the default Docker socket

Open james-s-w-clark opened this issue 1 year ago • 11 comments

Description

On my work mac I was trying Colima, and had to remove my old Docker Desktop socket and symlink Colima's socket - the issue & fix are documented here. My docker socket clash was also from testcontainers.

On my personal mac I was trying act to run GitHub Actions locally, and got

ERRO[0000] failed to obtain container engine info: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
...
Error: Error occurred running finally: Error occurred running finally: failed to list containers: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (original error: <nil>) (original error: unable to determine if image already exists for image 'ghcr.io/catthehacker/ubuntu:act-latest' (): Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?)

So I'm 2 for 2 on needing to delete the old socket and symlink Colima's. It seems very common for tools to point to that socket file.

My feature request is that it'd be great if Colima would either 1. just make it work on installation, or prompt and suggest to let it do the fix for you. Actually, is it even worth asking?

If we can remove this snagging point, it'd make the early user experience a lot smoother. The project descripition is after all:

Container runtimes on macOS (and Linux) with minimal setup

I've had no other issues/requests so far - it's been working great for a few days!

james-s-w-clark avatar Jul 12 '22 20:07 james-s-w-clark

I can understand your frustration. While it may be your experience, many tools are indeed catching up and utilising docker context instead.

Another advantage of this approach is the ability to try out Colima without breaking your current workflow.

But I do agree that we can provide an easier way for Colima to use the default docker socket.

abiosoft avatar Jul 14 '22 08:07 abiosoft

Tried using act again and the linked /var/run/docker.sock had disappeared. I don't think it was something I did - do socket files ever get cleaned up?

james-s-w-clark avatar Jul 28 '22 15:07 james-s-w-clark

If you are using any application that mounts the socket, it is possible. Unix sockets get deleted first before being re-created and mounted for socket connection.

abiosoft avatar Jul 28 '22 16:07 abiosoft

If you are using any application that mounts the socket, it is possible. Unix sockets get deleted first before being re-created and mounted for socket connection.

I see, thanks. To increase ease of use, would the solution be to add a file watcher for the socket file? It seems a bit far away from the core engine and stuff, but could be useful for many users

james-s-w-clark avatar Jul 28 '22 19:07 james-s-w-clark

I worked around a similar situation by exporting DOCKER_HOST=$HOME/.colima/docker.sock.

It'd be nice if colima status had subcommands or flags so that I could do something like export DOCKER_HOST=$(colima status socket).

jzelinskie avatar Dec 01 '22 03:12 jzelinskie

@abiosoft Would it be possible to get Colima to automatically symlink /var/run/docker.sock to $HOME/.colima/default/docker.sock? Or at least warn if it points somewhere else? That would help some hard-to-debug scenarios I've helped colleagues resolve lately.

henrik242 avatar Mar 30 '23 08:03 henrik242

@henrik242 it's on the roadmap.

Something similar to colima nerdctl install, maybe colima docker link-socket.

abiosoft avatar Mar 30 '23 15:03 abiosoft

(Is there a public roadmap?)

rfay avatar Mar 30 '23 15:03 rfay

(Is there a public roadmap?)

At the moment, no.

abiosoft avatar Mar 30 '23 16:03 abiosoft

(If you make one you can just link to it for more authoritative responses to questions like this; you could either use wiki or of course a markdown file in the repo.) And of course, thanks for all your work on this project!

Edit: Alternately, just answer questions like this with "I'm planning on it but don't know when it will be added" :)

rfay avatar Mar 30 '23 16:03 rfay