I have two different server machine with gitlab-runner hosted. I use one as development version, the other one as production release. I have the same configuration on both machine, so the lastest release of gitlab-runner and the lastest release of Docker/docker-compose.
Into my dockerfiles I need to download net-tools package in order to use netstat command. The builder docker is an official image of OpenJDK 14 and it is RHEL based. So, in order to install a new package, i can use only dnf/microdnf or yum.
Ok, everything should work simple and clear as exposed so far. But... when the machines try to run the command:
RUN microdnf install net-tools
On staging machine:
/bin/sh: microdnf: command not found
Instead, on production machine:
Job succeeded.
Okay, so what about yum? Let's change Dockerfile's net-tools installation
RUN yum install net-tools -y
Pipeline started, job scheduled and... staging machine:
Job succeeded.
On production machine, as you can figure:
/bin/sh: yum: command not found
I feel i little bit trapped because there is not another way to install package (dnf should be another possible way but it is not install on both docker images) and I don't want apply a workaround that can "test" the installation via microdnf or yum.
I hope I've made the problem as clear as I can.
This is not a proper solution, but at least it works. I mean, it's just a workaround that must be replaced as soon possible.
Anyway, in my docker-files, where I install microdnf/yum... I just do both, ignoring the errors. In Linux, you can "override" the exit status appending ';exit(0)' to you command.
On both machines what append is just execute the installations via yum and microdnf and, of course, one of them will carry out the operation successfully; instead, the other one will terminate with a "suffocated error".
This workaround will allows you to overcome this problem in a really rough way, but at least... it works. The "suffocated error" will just ignored and the operation go through without crashes.