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

Docker CLI Plugins: Use cliPluginsExtraDirs on Windows #7435

Merged
merged 6 commits into from
Sep 11, 2024

Conversation

mook-as
Copy link
Contributor

@mook-as mook-as commented Sep 9, 2024

On Windows, we don't have symlinks available. So instead of copying the plugins to ~/.docker/cli-plugins/, add a cliPluginsExtraDirs config entry instead so we look for them there.

On Windows it appears to prefer that (so leaving the old plugins in ~/.docker/cli-plugins is harmless; on Linux/mac it seems to prefer ~/.docker/cli-plugins (which makes no sense to me, but ¯\_(ツ)_/¯)

Note that this PR also moves all the plugins to their own directory (instead of resources/platform/bin), because we don't want to add everything else to the search path.

Fixes #7308

Due to an upcoming change to how the plugins will be instaled on Windows,
they need to be a directory that does _not_ contain `docker-credential-*`.
Therefore, download them into a separate directory instead.

Actual usage will be fixed in follow-up commits.

Signed-off-by: Mark Yen <[email protected]>
The previous commit downloaded the plugins to a different directory; update
the macOS and Linux integration manager to use that directory instead.
Windows will be fixed later.  We still add symlinks to `~/.rd/bin/` so that
if the user runs e.g. `docker-compose` instead of `docker compose`, the
executable will still be found.

Signed-off-by: Mark Yen <[email protected]>
Instead of copying the docker CLI plugins to `~/.docker/cli-plugins`, set
up `~/.docker/config.json` to add the Rancher Desktop docker CLI plugins
directory as an extra directory to scan for plugins.  On Windows, this
appears to take precedence over `~/.docker/cli-plugins`, therefore
resolving issues with not updating the plugins.  For symmetry, also do the
same for WSL distributions.

Signed-off-by: Mark Yen <[email protected]>
Now that we ship the plugins in a separate directory, we also need to add
that directory to $PATH so that if the user wants to call it directly it
can be done.

Signed-off-by: Mark Yen <[email protected]>
The plugins have been moved, so we need to provide a different directory if
they are called for.  This is used to locate `docker-compose` during
extension installation.

Signed-off-by: Mark Yen <[email protected]>
jandubois
jandubois previously approved these changes Sep 11, 2024
Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but I have some stylistic feedback/questions, if you want to take a look.

pkg/rancher-desktop/backend/containerClient/mobyClient.ts Outdated Show resolved Hide resolved
src/go/wsl-helper/pkg/integration/docker_plugin_linux.go Outdated Show resolved Hide resolved
src/go/wsl-helper/pkg/integration/docker_plugin_linux.go Outdated Show resolved Hide resolved
} else if filepath.Dir(target) == binPath {
// Remove the symlink, ignoring any errors.
_ = os.Remove(entryPath)
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we delete dangling symlinks too?

- Exclude docker credential helpers when checking for docker CLI plugins in
  moby client
- Rename various variables
- Other misc fixes

Signed-off-by: Mark Yen <[email protected]>
Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

@jandubois jandubois merged commit 67ece93 into rancher-sandbox:main Sep 11, 2024
17 checks passed
@mook-as mook-as deleted the docker-cli/extra-plugin-dir branch October 3, 2024 20:19
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.

Host docker plugins not updated on Windows
2 participants