Skip to content

Commit 8042103

Browse files
Merge pull request #1455 from ggbecker/include-podman-init
oscap-podman: add podman init to every scanned image/container.
2 parents 53affad + b4b1c9d commit 8042103

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

utils/oscap-podman

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,17 @@ else
7777
ID=$1
7878
TARGET="podman-container://$1"
7979
fi
80+
81+
# podman init creates required files such as: /run/.containerenv - we don't care about output and exit code
82+
podman init $ID &> /dev/null || true
83+
8084
DIR=$(podman mount $ID) || die
8185

86+
if [ ! -f "$DIR/run/.containerenv" ]; then
87+
# ubi8-init image does not create .containerenv when running podman init, but we need to make sure that the file is there
88+
touch "$DIR/run/.containerenv"
89+
fi
90+
8291
for VAR in `podman inspect $ID --format '{{join .Config.Env " "}}'`; do
8392
eval "export OSCAP_OFFLINE_$VAR"
8493
done

0 commit comments

Comments
 (0)