I'm trying to install xargs in a container running openjdk:17-oracle, but I'm unable to figure our what package manager is present in this image.
FROM openjdk:17-oracle
RUN apt-get install findutils
Throws error:
=> ERROR [stage-1 4/4] RUN apt-get install findutils 0.5s
------
> [stage-1 4/4] RUN apt-get install findutils:
#13 0.395 /bin/sh: apt-get: command not found
-
As does yum install findutils
, and several others.
I required xargs as this is used by the gradle runner to build the 'execute' command for my java process.
It's not really documented, but I found this in the issue tracker of the Oracle images for the Oracle Linux based images:
For the Alpine based images the command would be:
To answer this, you first need to find out what sort of base OS environment (if any) this container is based on.
One reasonably easy way is to 'inspect' the image. You can do this using Docker Desktop, or the 'docker inspect' command.
In this case, we can see 'microdnf' being used to install a package. 'microdnf' is a slimmed-down version of 'dnf' (modern replacement for 'yum'). Perhaps this image is based on the likes of a 'ubi' image (cut-down redistributable subset of Red Hat)...
You can also then start up the container and experiment. I've specified a different entry-point, because otherwise you get a jshell, which is not particularly useful for looking at how the image is built.
Knowing that 'microdnf' is the tool you'll be wanting; you can just use make a derivative container with the following in a new layer.
Trust that helps.