OpenLiberty / ci.docker

Eclipse Public License 1.0
44 stars 59 forks source link

yum fails via podman when using liberty ubi images #198

Open BarDweller opened 4 years ago

BarDweller commented 4 years ago

This is an odd one, if I extend a liberty ubi image (I've tried various, but for sure, openliberty/open-liberty:kernel-java8-openj9-ubi ) and try to use yum to install additional packages, it fails if the build is using podman.

RedHat installs podman instead of docker on rhel, and it's not too simple to put docker back instead.

If I code a simple Dockerfile that just extends adoptopenjdk/openjdk8-openj9:ubi and uses yum install, this works with both podman, and docker. Same if I extend the RH registry.access.redhat.com/ubi8/ubi image. There's something particular about the liberty images that's causing the failure.

I'd lean towards it being a podman bug, but @arthurdm suggested it get raised here first for an investigate to figure if liberty needs to raise this against podman.

Dockerfile

FROM openliberty/open-liberty:kernel-java8-openj9-ubi
USER root
RUN yum install iputils -y

Output

$> podman build .
STEP 1: FROM openliberty/open-liberty:kernel-java8-openj9-ubi
STEP 2: USER root
a90741eb0bd4399a7dbab9c2efcd490cbd8ea46bd7f85a55359c3e5f8879f5a7
STEP 3: RUN yum install iputils -y
Updating Subscription Management repositories.
Unable to read consumer identity
Subscription Manager is operating in container mode.
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Red Hat Universal Base Image 8 (RPMs) - BaseOS  3.8 MB/s | 766 kB     00:00    
Error: Cannot rename directory "/var/cache/dnf/ubi-8-baseos-53c30a88cff3796c/tmpdir.1LFk4E/repodata" to "/var/cache/dnf/ubi-8-baseos-53c30a88cff3796c/repodata": cannot create directory /var/cache/dnf/ubi-8-baseos-53c30a88cff3796c/repodata: File exists
Error: error building at STEP "RUN yum install iputils -y": error while running runtime: exit status 1

Workaround: adding RUN rm -rf /var/cache/dnf before the execution of yum install (a guess based on the error above) clears the issue, although that's probably not a great idea in the long run, it's enough to at least let me keep playing with the image.

faandg commented 2 years ago

We are also extending UBI images using buildah/podman and we have no issues with it. This issue is from 2020 though so a lot of version iterations have passed. Could have been an issue with the host system (permissions) or SELinux (since it happens during the package install step).