Openjdk -> /bin/sh: apt: command not found

Hi there,

on ubuntu 18.04 Im expering the following

FROM openjdk

RUN apt update

/bin/sh: apt: command not found

Any help ?

You may be encountering an issue with the minimalist intention that is likely behind the openjdk image, namely, that it’s intended to run Java. From what I can tell from the source repostiory (which is referenced in the readme for the image repo on the hub), the openjdk image is derived from Alpine, and may not have a general purpose shell, nor the apt-related commands.
If you want access to standard tooling, you may want to try the images derived from Oracle Linux, such as 12-jdk-oraclelinux7 , 12-oraclelinux7 , jdk-oraclelinux7 , oraclelinux7 , 12-jdk-oracle , 12-oracle , jdk-oracle
like so
$ docker run -it openjdk:12-jdk-oraclelinux7 sh
though the packaging tools there is yum
Alternately, you could also build your own image with the openjdk toolset using the Dockerfiles from their GitHub repo as guidelines.

Thanks. The oraclejdk:TAG and replacing the apt with yum solved the problem. Eventually, I needed the sh at the end of the docker run.