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

Add dockercli context awareness #11

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

redradrat
Copy link

So this is just a rough idea, as I wanted to use your tool with colima. Basically I wanted it to just work® with whatever I set as my current context in the actual docker cli.

This current implementation is ugly AF, but it works for me... so figured I'mma send you the PR to see if you'd be interested in the general idea.

@gregnr
Copy link
Member

gregnr commented Jun 17, 2022

Hey @redradrat, thank you for the idea and PR! I think this is a great enhancement to the lib and has no drawback from what I can see.

Can you confirm if this PR still works in a vanilla setup where the user hasn't created anything beyond the default context? I assume so, but would like to confirm.

@redradrat
Copy link
Author

redradrat commented Jun 20, 2022

So the default context will work, as well as not having a context set, then it would just assume the default host. But this needs a build and more testing... I'm not sure if I get to it... I kinda just made this so I can get on with things ^^

The problem is, if there is no existing docker config, I think it would initialize a blank one... not sure if that's good. Sure... it's unlikely, as I think we can expect the cli client to be in place, because you would only use this helper if you'd be running docker on mac. So that means you probably have booted up the VM by using docker. But still...

@redradrat
Copy link
Author

So it doesn't actually initialise the .docker config dir. It just assumes a "default" docker context. Which is the desired behaviour, I think.

@redradrat redradrat changed the title [WIP] Add dockercli context awareness Add dockercli context awareness Jul 28, 2022
@night0wl
Copy link

night0wl commented Jun 1, 2023

I did a bit of digging on this one.

When I run the binary manually using sudo it correctly resolved the current context defined in /Users/<me>/.docker, but when I run it as a brew service it tried to derive the context from /var/root/.docker which doesn't exist, so it always resolves to the default socket.

The only docker server I've tested that doesn't support using the default socket is Colima, which seems to have made a design choice not to, and tells users to manually create a symlink, which is what I've been doing.

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

Successfully merging this pull request may close these issues.

3 participants