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

[master / 22.06] docker buildx install breaks alias check #3789

Closed
thaJeztah opened this issue Sep 28, 2022 · 4 comments · Fixed by #3795
Closed

[master / 22.06] docker buildx install breaks alias check #3789

thaJeztah opened this issue Sep 28, 2022 · 4 comments · Fixed by #3795

Comments

@thaJeztah
Copy link
Member

Description

Not sure when this broke (did not yet do a bisect), but I noticed that if the ~/.docker/config.json contains an alias for builder (which happens after running docker buildx install), the CLI is broken;

docker version
not allowed to alias with builtin "buildx" as target

Reproduce

make -f docker.Makefile binary

Without alias installed:

rm ~/.docker/config.json
./build/docker version
Client:
 Version:           22.06.0-beta.0-140-g3dad26ca2.m
 API version:       1.42
 Go version:        go1.19.1
 Git commit:        3dad26ca2
 Built:             Wed Sep 28 22:36:09 2022
 OS/Arch:           darwin/arm64
 Context:           default
...

After running docker buildx install;

./build/docker buildx install

cat ~/.docker/config.json
{
	"auths": {},
	"aliases": {
		"builder": "buildx"
	}
}

./build/docker version
not allowed to alias with builtin "buildx" as target

The error occurs in this part of the code inside processAliases();

if _, _, err := cmd.Find(strings.Split(v, " ")); err == nil {
return args, osArgs, errors.Errorf("not allowed to alias with builtin %q as target", v)
}

Because the cmd.Find("buildx")) returns a cmd. From a quick test the cmd it finds may be the "stub" command we create for plugins; when disabling the buildx plugin (renaming the file), the problem goes away;

mv /usr/local/lib/docker/cli-plugins/docker-buildx /usr/local/lib/docker/cli-plugins/docker-buildx-disabled
 
./build/docker version
Client:
 Version:           22.06.0-beta.0-140-g3dad26ca2.m
 API version:       1.42
 Go version:        go1.19.1
 Git commit:        3dad26ca2
 Built:             Wed Sep 28 22:36:09 2022
 OS/Arch:           darwin/arm64
 Context:           default
...

Expected behavior

No response

docker version

current master (built from https://github.com/docker/cli/commit/3dad26ca2d418092b8c4e01b03d0455d583bec86)

Client:
 Version:           22.06.0-beta.0-140-g3dad26ca2.m
 API version:       1.42
 Go version:        go1.19.1
 Git commit:        3dad26ca2
 Built:             Wed Sep 28 22:36:09 2022
 OS/Arch:           darwin/arm64
 Context:           default

docker info

not relevant

Additional Info

No response

@thaJeztah
Copy link
Member Author

@crazy-max PTAL; perhaps you have an idea how we can detect if a command is a "plugin" or not (haven't looked closely yet; perhaps we have annotations we can use)

@crazy-max
Copy link
Member

crazy-max commented Sep 29, 2022

@thaJeztah I'm not able to repro with #3314 but with latest changes from master yes. I will take a look.

Edit: was able to bissect and it happens since #3429

@thaJeztah
Copy link
Member Author

I have an easy fix for this, but I think it's a partial fix (looking at better fixes that may also help with the performance regression)

Might push the "easy fix" first and fix the rest later

@thaJeztah
Copy link
Member Author

opened #3795 with the "easy" fix

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

Successfully merging a pull request may close this issue.

2 participants