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

After using podman tag, podman run fails #10648

Closed
wrobell opened this issue Jun 10, 2021 · 23 comments
Closed

After using podman tag, podman run fails #10648

wrobell opened this issue Jun 10, 2021 · 23 comments
Assignees
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

@wrobell
Copy link

wrobell commented Jun 10, 2021

/kind bug

The image cannot be found after tagging it with podman 3.2.0 (the below works with podman 3.1.1)

# podman tag 76c test-image
# podman images | grep test-image
localhost/test-image  latest            76c38d5eb978  7 weeks ago    289 MB
# podman run -it test-image
Error: test-image: image not known

but

# podman run 76c
'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs
@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Jun 10, 2021
@mheon
Copy link
Member

mheon commented Jun 11, 2021

@vrothberg PTAL - I suspect this is the localhost/ prefix?

@mheon
Copy link
Member

mheon commented Jun 11, 2021

@wrobell What Podman version, what distribution?

@mheon
Copy link
Member

mheon commented Jun 11, 2021

A full podman info would be very helpful.

@wrobell
Copy link
Author

wrobell commented Jun 11, 2021

@mheon

  • problem is with podman 3.2.0
  • everything is ok with podman 3.1.1
  • distro: ArchLinux
# podman info
host:
  arch: arm
  buildahVersion: 1.21.0
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.0.29-1
    path: /usr/bin/conmon
    version: 'conmon version 2.0.29, commit: 7e6de6678f6ed8a18661e1d5721b81ccee293b9b'
  cpus: 4
  distribution:
    distribution: archarm
    version: unknown
  eventLogger: journald
  hostname: rpi-mm4
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.10.42-1-ARCH
  linkmode: dynamic
  memFree: 1755041792
  memTotal: 4031725568
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 0.20-1
    path: /usr/bin/crun
    version: |-
      crun version 0.20
      commit: 0d42f1109fd73548f44b01b3e84d04a279e99d2e
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  os: linux
  remoteSocket:
    path: /run/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: false
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 0
  swapTotal: 0
  uptime: 45h 38m 2.75s (Approximately 1.88 days)
registries: {}
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 6
    paused: 0
    running: 2
    stopped: 4
  graphDriverName: overlay
  graphOptions:
    overlay.mountopt: nodev
  graphRoot: /var/lib/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 6
  runRoot: /var/run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 3.2.0
  Built: 1622932849
  BuiltTime: Sat Jun  5 23:40:49 2021
  GitCommit: 0281ef262dd0ffae28b5fa5e4bdf545f93c08dc7
  GoVersion: go1.16.4
  OsArch: linux/arm
  Version: 3.2.0

@rhatdan
Copy link
Member

rhatdan commented Jun 11, 2021

How did you create your test image?

@rhatdan
Copy link
Member

rhatdan commented Jun 11, 2021

cat /tmp/Containerfile | /bin/podman build -f - /tmp/test 
STEP 1: FROM alpine
STEP 2: run echo hello
hello
STEP 3: COMMIT
--> 967f1b76390
967f1b7639067e2d7f039fbeb4042758f14aeab052619bbdf8dd3d645d51258f
$ podman tag 967 dan
$ podman run dan
$ podman run dan echo hi
hi

@wrobell
Copy link
Author

wrobell commented Jun 11, 2021

The image is built using buildah, then

  1. Saved as OCI archive.
  2. Copied to the target machine.
  3. Imported from the OCI archive.
  4. Tagged with podman.

Please note, that I can run the image using its image id (see the last command in the description of the bug).

@vrothberg
Copy link
Member

I suspect that the image's architecture is not matching the one of your local machine.

Can you share the output of podman image inspect --format "Arch: {{.Architecture}}, OS: {{.Os}}" test-image?

@wrobell
Copy link
Author

wrobell commented Jun 11, 2021

# podman image inspect --format "Arch: {{.Architecture}}, OS: {{.Os}}" test-image
Arch: armv7l, OS: linux
# uname -a
Linux rpi-mm4 5.10.42-1-ARCH #1 SMP Tue Jun 8 14:18:39 UTC 2021 armv7l GNU/Linux

@vrothberg
Copy link
Member

Does podman run --arch=armv7l --os=linux test-image ls work?

@vrothberg vrothberg self-assigned this Jun 11, 2021
@vrothberg
Copy link
Member

Aaaah, I am slowly getting a feeling for the issue. Bottom line: the image is not OCI compliant.

The image specification states that the mentioned architecture of an image must adhere to the GOARCH values. armv7l is not a valid value, so the match won't work.

In a previous version, Podman would just pick the local image even if the architecture does not match. This is something we've fixed.

How was the OCI archive created?

@wrobell
Copy link
Author

wrobell commented Jun 11, 2021

# podman run --arch=armv7l --os=linux test-image ls
Error: error getting default registries to try: short-name "test-image" did not resolve to an alias and no unqualified-search registries are defined in "/etc/containers/registries.conf"

@wrobell
Copy link
Author

wrobell commented Jun 11, 2021

The OCI archive was created using buildah.

# buildah inspect 76 | grep version
...
                "io.buildah.version": "1.20.0"
...
``

@wrobell
Copy link
Author

wrobell commented Jun 11, 2021

So it seems I should rebuild my images? Or is there some chance for transition period with a warning?

@vrothberg
Copy link
Member

So it seems I should rebuild my images?

Yes, that would be good.

Or is there some chance for transition period with a warning?

Hard to say. We did not consider mistakenly wrong architectures.

I am currently investigating if there is programmatic way of detecting wrong os/arch combinations and warn about them during image lookup.

NOTE: one workaround is to use the image ID. That will instruct Podman to use exactly this image. A lookup by name will always perform the os/arch matching.

@rhatdan what do you think?

@wrobell
Copy link
Author

wrobell commented Jun 11, 2021

BTW. For architectures armv6 and armv7l, the only matching entry in "architecture" field is to be "arm", isn't it? Therefore it will not be possible to distinguish between these two?

BTW. @vrothberg The relevant part of the image specification uses "should", not "must".

@vrothberg
Copy link
Member

BTW. For architectures armv6 and armv7l, the only matching entry in "architecture" field is to be "arm", isn't it?

Either "arm" or "arm64". I am always lost in the vast forest of ARM platforms.

Therefore it will not be possible to distinguish between these two?

An image index or in Docker-slang a "manifest list" has a "variant" field for discriminating platforms.

BTW. @vrothberg The relevant part of the image specification uses "should", not "must".

Fair point. That means the image is compliant but off the recommended path. I will investigate, why run --arch=armv7l doesn't select it. I think that's a good middle ground.

vrothberg added a commit to vrothberg/common that referenced this issue Jun 11, 2021
Allow for looking up images via customizable arch, os and variant.
This prevents `podman run --arch=xxx` from redundantly pulling down the
image if needed.

Context: containers/podman/issues/10648
Signed-off-by: Valentin Rothberg <[email protected]>
@vrothberg
Copy link
Member

Fair point. That means the image is compliant but off the recommended path. I will investigate, why run --arch=armv7l doesn't select it. I think that's a good middle ground.

I opened containers/common#622. It will require some plumbing in Podman as well but is a good first step. Once done, even a podman run --arch=foobar would work if a matching image of arch foobar is present in the local storage.

I'll be on vacation for a couple of days, so this will be something to land in Podman v3.3.

@wrobell
Copy link
Author

wrobell commented Jun 11, 2021

I have just build an image on my laptop using buildah 1.21.0

# podman inspect test-image | grep arch
                "io.balena.architecture": "armv7hf",
            "io.balena.architecture": "armv7hf",

Should I wait for newer version of buildah?

@mheon
Copy link
Member

mheon commented Jun 11, 2021

This sounds like a potential Buildah bug, then - @TomSweeneyRedHat @nalind Can you guys take a look?

@nalind
Copy link
Member

nalind commented Jun 11, 2021

Yeah, the defaults we set when we don't have values to inherit from a base image probably need a going over for arm and variants.

@vrothberg
Copy link
Member

@wrobell, could you open an additional issue for Buildah?

@vrothberg
Copy link
Member

Once containers/common#634 is merged, I will do some plumbing in Podman and then it should work again. There are further use cases that suggest that Podman should continue eating those images.

vrothberg added a commit to vrothberg/libpod that referenced this issue Jun 24, 2021
Much to my regret, there is a number of images in the wild with invalid
platforms breaking the platform checks in libimage that want to make
sure that a local image is matching the expected platform.

Imagine a `podman run --arch=arm64 fedora` with a local amd64 fedora
image.  We really shouldn't use the local one in this case and pull down
the arm64 one.

The strict platform checks in libimage in combination with invalid
platforms in images surfaced in Podman being able to pull an image but
failing to look it up in subsequent presence checks.  A `podman run`
would hence pull such an image but fail to create the container.

Support images with invalid platforms by vendoring the latest HEAD from
containers/common.  Also remove the partially implemented pull-policy
logic from Podman and let libimage handle that entirely.  However,
whenever --arch, --os or --platform are specified, the pull policy will
be forced to "newer".  This way, we pessimistically assume that the
local image has an invalid platform and we reach out to the registry.
If there's a newer image (i.e., one with a different digest), we'll pull
it down.

Please note that most of the logic has either already been implemented
in libimage or been moved down which allows for removing some clutter
from Podman.

[NO TESTS NEEDED] since c/common has new tests.  Podman can rely on the
existing tests.

Fixes: containers#10648
Fixes: containers#10682
Signed-off-by: Valentin Rothberg <[email protected]>
trusch pushed a commit to trusch/common that referenced this issue Jun 30, 2021
libmage: Exists: catch corrupted images

While various execution paths in libimage already handle corrupted
images, `(*Runtime).Exists()` did not and would list an image to exist
in the storage even if it is corrupted.

Some corruptions can only be detected when accessing the individual
data.  A reliable way of accessing such data is to inspect an image.
Hence, an image will only be listed to exist if a) it has been found
and b) can be inspected.  If the inspection fails, the image will be
reported to not exists but without an error.  That allows for users
of libimage to properly recover and repull.

Further, add a new unit tests that forces a data corruption and
gradually recovers from it.

Podman will now behave as follows:
```
$ ./bin/podman run -d --rm nginx ls
ERRO[0000] Image nginx exists in local storage but may be corrupted: layer not known
ERRO[0000] Looking up nginx in local storage: layer not known
Resolved "nginx" as an alias (/home/vrothberg/.cache/containers/short-name-aliases.conf)
Trying to pull docker.io/library/nginx:latest...
Getting image source signatures
Copying blob 596b1d696923 skipped: already exists
Copying blob 30afc0b18f67 skipped: already exists
Copying blob febe5bd23e98 skipped: already exists
Copying blob 69692152171a skipped: already exists
Copying blob 8283eee92e2f skipped: already exists
Copying blob 351ad75a6cfa done
Copying config d1a364dc54 done
Writing manifest to image destination
Storing signatures
56b65883c3c32b67277bcc173bd9f26c27cbbdbc6d3aacf6c552be796eb7a337
```

Signed-off-by: Valentin Rothberg <[email protected]>

Add default for log-tag

Needed for containers/podman#10204

Signed-off-by: Daniel J Walsh <[email protected]>

build(deps): bump github.com/containers/storage from 1.32.1 to 1.32.2

Bumps [github.com/containers/storage](https://github.com/containers/storage) from 1.32.1 to 1.32.2.
- [Release notes](https://github.com/containers/storage/releases)
- [Changelog](https://github.com/containers/storage/blob/master/docs/containers-storage-changes.md)
- [Commits](containers/storage@v1.32.1...v1.32.2)

---
updated-dependencies:
- dependency-name: github.com/containers/storage
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

fix autodiscovery of the secret passdriver.

add 'secret' section to the containers.conf struct.

libimage: fix Exists

Commit 964b002 introduced a regression to Exists() which would
return an error if the image does not exist.

Signed-off-by: Valentin Rothberg <[email protected]>

Sort containers.conf and containers.conf.5.md

Remove cgroup_check which is no longer needed.

Fixes: containers#372

Signed-off-by: Daniel J Walsh <[email protected]>

Add support for config drop in directories

Fixes: containers#368

Signed-off-by: Daniel J Walsh <[email protected]>

Fix spacing on name value pairs to be consistent

Replaces:  containers#556

Signed-off-by: unknowndev233@github [email protected]
Signed-off-by: Daniel J Walsh <[email protected]>

seccomp: allow timer_settime64

allow time64 variant of timer_settime which was missed in 4e31f66

Signed-off-by: Jan Palus <[email protected]>

seccomp: add support for defaultErrnoRet

Add support to specify the default errno return value.

The OCI runtime specs already have support for it, and both crun (>=
0.19) and runc (>= 1.0-rc95) have support for it.

Signed-off-by: Giuseppe Scrivano <[email protected]>

seccomp: switch default to ENOSYS

add the currently blocked syscalls to a deny-list and switch the
default to ENOSYS.

Signed-off-by: Giuseppe Scrivano <[email protected]>

build(deps): bump github.com/containers/image/v5 from 5.12.0 to 5.13.0

Bumps [github.com/containers/image/v5](https://github.com/containers/image) from 5.12.0 to 5.13.0.
- [Release notes](https://github.com/containers/image/releases)
- [Commits](containers/image@v5.12.0...v5.13.0)

---
updated-dependencies:
- dependency-name: github.com/containers/image/v5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Strip extra trailing newlines in templates

When wrapping table format in range, string extra new lines from table
ends.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1855983

Signed-off-by: Jhon Honce <[email protected]>

Use SetCredentials and add verbose to loginopts

Signed-off-by: flouthoc <[email protected]>

Bump to v0.40.0

Signed-off-by: Daniel J Walsh <[email protected]>

Move to v0.40.1-dev

Signed-off-by: Daniel J Walsh <[email protected]>

Set BigFilesTemporaryDir to GetEnv(TMPDIR) if set or /var/tmp

Currently if the caller does not specify the BigFilesTemporaryDir,
Podman and Buildah users expect this to default TMPDIR environment
variable or /var/tmp if not set.

Moving to libimage caused a regression in this functionality.

Signed-off-by: Daniel J Walsh <[email protected]>

build(deps): bump github.com/containers/image/v5 from 5.13.0 to 5.13.1

Bumps [github.com/containers/image/v5](https://github.com/containers/image) from 5.13.0 to 5.13.1.
- [Release notes](https://github.com/containers/image/releases)
- [Commits](containers/image@v5.13.0...v5.13.1)

---
updated-dependencies:
- dependency-name: github.com/containers/image/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

libimage: force remove: only untag on multi tag image

When removing an image by name, do not remove the image and all its
tags, even if force is set.  Instead, just untag the specified name.

Note: adjust the load test to preserve the order in the untagged field.

Also vendor in the latest HEAD in containers/image to fix a bug revealed
in Podman CI.

Context: containers/podman/issues/10685
Signed-off-by: Valentin Rothberg <[email protected]>

libimage: lookup images by custom platform

Allow for looking up images via customizable arch, os and variant.
This prevents `podman run --arch=xxx` from redundantly pulling down the
image if needed.

Context: containers/podman/issues/10648
Signed-off-by: Valentin Rothberg <[email protected]>

seccomp: allow clone3

Signed-off-by: Giuseppe Scrivano <[email protected]>

seccomp: let io_uring_* fail with ENOSYS

Signed-off-by: Giuseppe Scrivano <[email protected]>

seccomp: allow pkey_*

Signed-off-by: Giuseppe Scrivano <[email protected]>

seccomp: allow rseq

Signed-off-by: Giuseppe Scrivano <[email protected]>

seccomp: let membarrier fail with ENOSYS

Signed-off-by: Giuseppe Scrivano <[email protected]>

seccomp: always allow get_mempolicy, set_mempolicy, mbind

Signed-off-by: Giuseppe Scrivano <[email protected]>

Vendor in containers/image v5.13.2

Signed-off-by: Daniel J Walsh <[email protected]>

Vendor in containers/image v5.13.2

Signed-off-by: Daniel J Walsh <[email protected]>

Bump to v0.40.1

Signed-off-by: Daniel J Walsh <[email protected]>

Move to v0.40.2-dev

Signed-off-by: Daniel J Walsh <[email protected]>

feat: add external secret driver.

use /bin/sh instead of /bin/bash

fix test by removing accidentially added driver setup.

rename externaldriver to shelldriver

Signed-off-by: Tino Rusch <[email protected]>

remove commented test setup

Signed-off-by: Tino Rusch <[email protected]>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2023
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

5 participants