Jib does not use Dockerfile
(and it works even without Docker installed); the way Jib builds an image is fundamentally different from how the Docker CLI builds an image using Dockerfile
(reproducible vs. non-reproducible, declarative vs. imperative, Docker and Dockerfile
-less build vs. requiring Docker daemon and client, requiring root-privilege vs. not). Basically, Jib doesn't "run" Dockerfile
directives, particularly the ones like RUN
that executes something; Jib doesn't provide/include a Docker runtime (that is one of the points of Jib).
For installing complex software packages like OpenJDK, the best option (for now) is to prepare a custom base image that comes with all those packages pre-installed and have Jib use that image. Note recent Jib versions can specify a local Docker daemon image or a tarball as a base image (in addition to a remote registry image).
If you just need to install a small number of binaries, you can copy arbitrary files with the extraDirectories
feature (Maven / Gradle). Here is an example that installs a Stackdriver Debugger Java agent using the feature.
Just in case, you can configure Jib to run arbitrary ENTRYPOINT
or CMD
, or include custom script files (using the extraDirectories
feature) and run them at runtime, but I don't really think you are asking this capability. I believe your goal is to install extra software packages at build time.