Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
james-s-w-clark opened this issue Jul 12, 2022 · 11 comments
Open
Labels
enhancement New feature or request

Comments

@james-s-w-clark
Copy link

james-s-w-clark commented Jul 12, 2022

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!

@abiosoft
Copy link
Owner

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 abiosoft added the enhancement New feature or request label Jul 14, 2022
@abiosoft abiosoft changed the title Various socket-related failures after switching from Docker Desktop to Colima No easy way to configure Colima to use the default Docker socket Jul 14, 2022
@james-s-w-clark
Copy link
Author

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?

@abiosoft
Copy link
Owner

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.

@james-s-w-clark
Copy link
Author

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

@jzelinskie
Copy link

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

@henrik242
Copy link

@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.

@abiosoft
Copy link
Owner

@henrik242 it's on the roadmap.

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

@rfay
Copy link
Contributor

rfay commented Mar 30, 2023

(Is there a public roadmap?)

@abiosoft
Copy link
Owner

(Is there a public roadmap?)

At the moment, no.

@rfay
Copy link
Contributor

rfay commented Mar 30, 2023

(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" :)

@james-s-w-clark
Copy link
Author

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

https://github.com/abiosoft/colima/blob/main/docs/FAQ.md#cannot-connect-to-the-docker-daemon-at-unixvarrundockersock-is-the-docker-daemon-running

Adding the suggested export DOCKER_HOST="unix://${HOME}/.colima/default/docker.sock" to my ~/.zshrc was what fixed it this time. Trying Colima again 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants