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

Use --platform / --arch etc., podman will not lookup image shortname #22420

Closed
soiamsoNG opened this issue Apr 18, 2024 · 13 comments
Closed

Use --platform / --arch etc., podman will not lookup image shortname #22420

soiamsoNG opened this issue Apr 18, 2024 · 13 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@soiamsoNG
Copy link

Issue Description

if run/build use --platform / --arch etc, podman will not lookup shortname already in local with same platform (use podman inspect output info Architecture/OS), and prompt user to select registry

if use localhost/shortname exact as the RepoTags it will work

microsoft/vscode-remote-release#9748

Steps to reproduce the issue

Steps to reproduce the issue

  1. podman build --platform xxxx -f Dockerfile

Describe the results you received

Prompt select image registry

Describe the results you expected

same behaviour as without --platform or --arch
just prompt user select registry when no already build image's platform or arch or os match its shortname.

podman info output

podman version 4.9.4

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

No

Additional environment details

No response

Additional information

No response

@soiamsoNG soiamsoNG added the kind/bug Categorizes issue or PR as related to a bug. label Apr 18, 2024
@baude
Copy link
Member

baude commented Apr 22, 2024

@vrothberg what say you?

@vrothberg
Copy link
Member

Please share a full reproducer. Based on the description I am unable to reproduce.

@soiamsoNG
Copy link
Author

soiamsoNG commented Apr 23, 2024

create Dockerfile

FROM alpine:latest
CMD ["echo","hello world"]

follow below step

  1. podman pull docker.io/alpine:latest
  2. podman inspect alpine      (get the architecture info as amd64)
  3. podman --arch amd64 --file Dockerfile      (the prompt of registry select show up)
  4. podman --file Dockerfile       (the prompt of registry will not show up)

step 3 and 4 same Dockerfile different behavior

@rhatdan
Copy link
Member

rhatdan commented Apr 23, 2024

podman build --arch amd64 --file Dockerfile (the prompt of registry select show up)
podman build --file Dockerfile (the prompt of registry will not show up)

I think you meant, this looks like it might be the same issue as:

containers/buildah#5478

@rhatdan
Copy link
Member

rhatdan commented Apr 23, 2024

Could you try --platform linux/amd64 to see if it fixes your issue.

@soiamsoNG
Copy link
Author

--platform linux/amd64 not fix the issue ,the prompt of registry select show up

@vrothberg
Copy link
Member

It works exactly as designed. Once you have selected an image and it's pulled down, the selection is being recorded.

See https://www.redhat.com/sysadmin/container-image-short-names for details on the behavior.

@soiamsoNG
Copy link
Author

soiamsoNG commented Apr 24, 2024

maybe I made you miss understand, step 3 and step 4 can be exchange the order, and same difference behavior.
step 1 , step 2 , step 4 never give us any select prompt.

@vrothberg
Copy link
Member

Which system are you running on? If there's a recorded alias, there will be no prompt.

@soiamsoNG
Copy link
Author

fedora 39, podman version 4.9.4,

the post you provide said below but I never find this file
Podman will automatically record a new short-name alias in the users $HOME/.config/containers/short-name-aliases.conf file

and please take a detail look at below workaround for this issue, it still will search local/localbuildimage but not at the first, it prompt first if there is more than one registry even with local match.
microsoft/vscode-remote-release#9748 (comment)

May be this issue title not match the exact issue. may be re-title to will not lookup local image first.

@vrothberg
Copy link
Member

Fedora 39 ships with /etc/containers/registries.conf.d/000-shortnames.conf which has an alias for alpine, so pulling this image will never show a prompt.

and please take a detail look at below workaround for this issue, it still will search local/localbuildimage but not at the first, it prompt first if there is more than one registry even with local match.
microsoft/vscode-remote-release#9748 (comment)

I need an exact reproducer. Sorry, I am a bit lost in what the problem is.

I am sure we'll get to the bottom of the issue.

@soiamsoNG
Copy link
Author

Just update to fedora 40, podman version 5.0.1

find alpine in /etc/containers/registries.conf.d/000-shortnames.conf

Sorry can't let you you get to reproducer I refind the step description to below

make sure more than one registry by below command

podman info -f json | jq '.registries["search"]'

Dockerfile

FROM alpine:latest
CMD ["echo","hello world"]

Dockerfile2

FROM localalpine:latest
CMD ["echo","hello world2"]

prompt will not come out with below step (I think it can find image localalpine )

podman pull alpine:latest
podman build --file Dockerfile -t localalpine
podman build --file Dockerfile2 -t locallocalalpine

prompt will show at the third step of below (don't know why image localalpine alreay in local and prompt show behavior not as above three step, but you can force it to fallback to use local image by limit remote registry to only one)

podman pull alpine:latest
podman build --file Dockerfile -t localalpine
podman build --arch amd64 --file Dockerfile2 -t locallocalalpine

@vrothberg
Copy link
Member

Thanks a lot for providing the reproducer. It's essentially the same issue as #17063. #12682 gives some important context as well.

@stale-locking-app stale-locking-app bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Jul 24, 2024
@stale-locking-app stale-locking-app bot locked as resolved and limited conversation to collaborators Jul 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

4 participants