Skip to content

Conversation

@kirked
Copy link

@kirked kirked commented Oct 17, 2024

Allows rootless container provider on macOS.

@kirked kirked requested a review from a team October 17, 2024 21:16
@eddumelendez
Copy link
Member

eddumelendez commented Oct 17, 2024

Hi, thanks for your contribution. Can you elaborate more on this change, please? Testcontainers provides a strategy to look at Docker Desktop rootless. See https://github.com/testcontainers/testcontainers-java/blob/main/core/src/main/java/org/testcontainers/dockerclient/DockerDesktopClientProviderStrategy.java#L14-L25

@kirked
Copy link
Author

kirked commented Oct 21, 2024

Hi, thanks for your contribution. Can you elaborate more on this change, please? Testcontainers provides a strategy to look at Docker Desktop rootless. See https://github.com/testcontainers/testcontainers-java/blob/main/core/src/main/java/org/testcontainers/dockerclient/DockerDesktopClientProviderStrategy.java#L14-L25

This change enables macOS users to use the RootlessDockerClientProviderStrategy just as Linux users can, by using a Unix socket.

@eddumelendez
Copy link
Member

This change enables macOS users to use the RootlessDockerClientProviderStrategy just as Linux users can, by using a Unix socket.

This is what I understand by looking at the changes. However, would be helpful is you can link to some documentation in order to make sure this is really the change to do or if requires something else.

@kirked
Copy link
Author

kirked commented Oct 21, 2024

I was able to make this change from a Clojure REPL via reflection, and that enabled the RootlessDockerClientProviderStrategy to work with no other changes.

Honestly I don't know why macOS was overlooked for this strategy when the UnixSocketClientProviderStrategy has macOS enabled: https://github.com/testcontainers/testcontainers-java/blob/main/core/src/main/java/org/testcontainers/dockerclient/UnixSocketClientProviderStrategy.java#L47

@eddumelendez
Copy link
Member

That doesn't answer the question. I have installed Docker Desktop and when I look at ~/.docker/run/ is empty. I don't think there is a path for /run/user/ neither. Have you made a special installation of Docker Desktop or another container runtime that uses that location? I'm trying to get more context.

@kirked
Copy link
Author

kirked commented Oct 22, 2024

No, it's a standard docker install, but not docker desktop, as that is a commercial product and can't be used. I use Colima for the docker machine.

brew install docker docker-credential-helper colima
colima start
colima stop

then edit ~/.docker/config.json to set the context to "colima" and the credsStore to "osxkeychain". If you wanna use macOS virtualization+virtiofs instead of qemu+sshfs edit ~/.colima/colima.yaml and rm -rf ~/.colima/_lima/colima.

From then on, you can just do colima start and use docker as normal (from the cli).

@eddumelendez
Copy link
Member

eddumelendez commented Oct 22, 2024

Thanks for sharing, don't you need to follow these steps? I tried without removing rm -rf ~/.colima/_lima/colima but TBH, looks like the simple change will not cause effect to make it work with colima automatically. Currently, I would just follow the instructions for a colima integration. LMK if I missing something

@kirked
Copy link
Author

kirked commented Oct 24, 2024

The question becomes, why the disparity between UnixSocketClientProvider and RootlessDockerClientProvider?

@eddumelendez
Copy link
Member

Every strategy look for specific paths or configurations that can be achieved only in specific OS and those are not mixed. Follow #9140, this will solve your issue by reading the docker context once is merged.

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.

2 participants