Open mhrivnak opened 2 years ago
In the files copied out of the container image by the podman cp
command, I see the /root
directory has these permissions:
$ ls -ld delme/root
dr-xr-x---. 3 mhrivnak mhrivnak 4096 Feb 24 06:08 delme/root
Note the lack of write permission. On linux it doesn't seem to matter; podman can create the files within that directory anyway. But on OSX it fails to create a file within that directory, presumably because of this issue. But I don't know why the behavior is different.
Here is a reproducer using only the podman commands that get run by opm
:
#!/usr/bin/env bash
podman pull registry.redhat.io/redhat/redhat-operator-index:v4.10
CONTAINERID="$(podman create registry.redhat.io/redhat/redhat-operator-index:v4.10)"
echo "--> Created new container $CONTAINERID"
OUTDIR="$(mktemp -d ./bug.XXXXXX)"
echo "--> Created temp dir $OUTDIR"
podman cp --log-level=trace "$CONTAINERID:/." "$OUTDIR/"
This bug can be avoided if the Unpack behavior were to only copy out the database file from the image, and not copy out the entire contents of the container image's filesystem.
That would also be more efficient. Right now for example with registry.redhat.io/redhat/redhat-operator-index:v4.10
, unpack writes 688MB to disk, whereas index.db
is only 75MB.
Would that break anything if we change opm to only copy out the index file?
It shouldn't -- I attempted to do exactly that in #800 but couldn't figure out why tests were failing on it. It ended up deprioritized but I/someone else could pick it back up
Looks like this was fixed upstream in podman, which is great. I suppose we will still have this issue with docker-based opm prune commands though.
One other solution is to break up the pulling and unpacking tool for the opm prune
command. This was done in opm index add
to help alleviate some issues.
The proposed solution would be to implement a flag such as --pull-tool
such that unpacking can be done via containerd, but building can be done with podman.
@joelanford @grokspawn Any idea on whether this is still an issue with recent registry releases?
@joelanford @grokspawn Any idea on whether this is still an issue with recent registry releases?
yes podman 4.2.1 opm Version: version.Version{OpmVersion:"5cfc4d643", GitCommit:"5cfc4d643f5fead6b02aa40a2a661b0fa64a2958", BuildDate:"2022-08-25T05:31:05Z", GoOs:"darwin", GoArch:"amd64" (4.10.34)
Versions
opm version:
podman version:
Problem
I ran the following command to prune an index. It works on a linux box but fails on a Mac:
It exits with code 125 and the following output: