You are not logged in.
I have the docker file below (taken from https://www.keycloak.org/server/containers ). Building takes an exceptionally long time to run ~1000s. I can see that it is caused by the RUN dnf install... command. Specifically, the build has multiple `Running scriptlet: ...`s that are the culprit. I've been looking around for similar issues and came across these that may be related
https://bugzilla.redhat.com/show_bug.cgi?id=1488639
https://github.com/moby/moby/issues/18316
The second issue alludes to btrfs potentially being involved, which I am also using. Any tips/insights would be much appreciated ![]()
Installed packages:
docker 1:24.0.7-1
docker-buildx 0.11.2-1
docker-compose 2.23.1-1
```
FROM registry.access.redhat.com/ubi9 AS ubi-micro-build
RUN mkdir -p /mnt/rootfs
RUN dnf install --installroot /mnt/rootfs curl --releasever 9 --setopt install_weak_deps=false --nodocs -y && \
dnf --installroot /mnt/rootfs clean all && \
rpm --root /mnt/rootfs -e --nodeps setup
FROM quay.io/keycloak/keycloak:22.0.4
COPY --from=ubi-micro-build /mnt/rootfs /
ENTRYPOINT ["/opt/keycloak/bin/kc.sh"]
```
Offline
Increase the log level on the docker build command or the dnf install in the .dockerfile (or both) and see what dnf is actually doing. It could be network speed while downloading the package(s), or disk access, etc.
Offline
I've attempted to make both more verbose by adding `--verbose` to the `dnf install` as well as well as building the image with `docker build --progress=plain`. I don't see any additional information. Full logs can be seen here https://gist.github.com/shot-codes/a690 … aeedc85df1
Offline
Installing 'curl' brings in a lot of dependencies that are not already installed on your ubi9 base image. The packages' download time seem OK to me at ~ 25 seconds, but the disk access required during the package install scripts looks like the culprit:
#8 35.08 Running scriptlet: glibc-2.34-83.el9_3.7.x86_64 13/57
==> this step takes almost 4 minutes
#8 380.4 Running scriptlet: ca-certificates-2023.2.60_v7.0.306-90.1.el9_2.noar 50/57
==> this step takes another 4 minutes
#8 612.2 Running scriptlet: filesystem-3.16-2.el9.x86_64 57/57
#8 727.6 Running scriptlet: ca-certificates-2023.2.60_v7.0.306-90.1.el9_2.noar 57/57
#8 843.4 Running scriptlet: curl-7.76.1-26.el9_3.2.x86_64 57/57
#8 957.9 Verifying : alternatives-1.24-1.el9.x86_64 1/57
==> here is another 4 minutesThe easiest solution would be to start with a different base image that already has most of the packages installed, specifically curl, if you want to stick to a RedHat-based image. But, in general, this is likely not an Arch problem. You may get better performance if you change the backend storage you have configured for Docker to write its layers, but I think that's a long shot. The better solution would be to switch to an image that is a better starting point for the build.
Why, for example, would you not use an actual keycloak image as a base?
Offline
To speed up DNF Package Manager in Fedora, RHEL and its Clones:
sudo nano /etc/dnf/dnf.confAdd these two lines to the .conf:
max_parallel_downloads=10
fastestmirror=TrueOffline