I tried to build an image with openjdk:17 base image with git installed and maven:3.5.0 but it is failing to build the image and throwing error, shared the error message below. Can anyone help me to solve this issue?
[2/6] RUN apt-get -y update && apt-get install -y git && rm -rf /var/lib/apt/lists/*:
0.202 /bin/sh: apt-get: command not found
Dockerfile:6
5 |
6 | >>> RUN apt-get -y update &&
7 | >>> apt-get install -y git &&
8 | >>> rm -rf /var/lib/apt/lists/*
9
ERROR: failed to solve: process “/bin/sh -c apt-get -y update && apt-get install -y git && rm -rf /var/lib/apt/lists/*” did not complete successfully: exit code: 127
meyay
(Metin Y.)
March 8, 2024, 7:40am
2
Can you share why you think apt-get should exist in the base image?
Furthermore, can you share how you identified that the base image actually is based on debian/ubuntu?
I used openjdk:17 so I thought it is Debian based image and I used ‘apt-get’
but when I run the openjdk17 image I found it is based on Oracle Linux Server
docker run -it openjdk:17 bash
bash-4.4# cat /etc/os-release
NAME=“Oracle Linux Server”
VERSION=“8.5”
ID=“ol”
ID_LIKE=“fedora”
VARIANT=“Server”
VARIANT_ID=“server”
VERSION_ID=“8.5”
PLATFORM_ID=“platform:el8”
PRETTY_NAME=“Oracle Linux Server 8.5”
ANSI_COLOR=“0;31”
CPE_NAME=“cpe:/o:oracle:linux:8:5:server”
HOME_URL=“https://linux.oracle.com/ ”
BUG_REPORT_URL=“https://bugzilla.oracle.com/ ”
ORACLE_BUGZILLA_PRODUCT=“Oracle Linux 8”
ORACLE_BUGZILLA_PRODUCT_VERSION=8.5
ORACLE_SUPPORT_PRODUCT=“Oracle Linux”
ORACLE_SUPPORT_PRODUCT_VERSION=8.5
Can you help me to install git in this image?
I tried ‘apt-get’, ‘apk’ and ‘yum’ but none of these worked
bluenobly
(Bluenobly)
March 8, 2024, 8:46am
4
The image is based on Oracle Linux. It uses yum or dnf .
dnf install git -y
But you should use a different image. This image is officially deprecated.
Take a look at the deprecation notices under
https://hub.docker.com/_/openjdk
And note the vulnerabilities under
https://hub.docker.com/layers/library/openjdk/17-jdk-oracle/images/sha256-98f0304b3a3b7c12ce641177a99d1f3be56f532473a528fda38d53d519cafb13
Thank you for your response now I used openjdk:11 and it is working fine
bluenobly
(Bluenobly)
March 8, 2024, 9:18am
6
All openjdk builds are deprecated see:
opened 02:36PM - 09 Jun 22 UTC
closed 11:22PM - 01 Jul 22 UTC
Hi!
This is a heads-up that we are going to retire "[OpenJDK Project Builds](… https://adoptopenjdk.net/upstream.html)" for OpenJDK 11u and OpenJDK 8u. We plan to stop producing builds after the July 2022 CPU update (11.0.16 and 8u342 will be the last builds). Since we know that the docker library is using those for the `docker.io/library/openjdk:11` and `docker.io/library/openjdk:8` images, we wanted to give a heads-up that this is going to happen. Perhaps it would be best to remove the `11` and `8` tags (in October 2022, perhaps) as at that point these images would be out-of-date without recent security fixes. I see that the `docker.io/library/openjdk:17` tag points already to an outdated build (`17.0.2` over latest `17.0.3`).
We, Red Hat, have produced those builds as a service to the community for Linux x86_64, Linux aarch64 and Windows x86_64. Now with projects like [Eclipse Adoptium](https://projects.eclipse.org/projects/adoptium) which produce [Eclipse Temurin](https://adoptium.net/temurin/releases/) builds on a wider variety of platforms which are JCK tested there is a natural replacement for a vendor neutral OpenJDK build for the JDK 8 and JDK 11 code streams for the community to use. For the 17u code stream of the OpenJDK updates project the builds linked from the OpenJDK wiki are already Eclipse Temurin binaries and we'd like to make this consistent come October 2022.
Now with projects like Eclipse Adoptium which produce Eclipse Temurin builds on a wider variety of platforms which are JCK tested there is a natural replacement for a vendor neutral OpenJDK build for the JDK 8 and JDK 11 code streams for the community to use.
Upstream binaries were built by Red Hat on their infrastructure and distributed by AdoptOpenJDK on behalf of the OpenJDK jdk8u and jdk11u community projects. The last releases produced by this method were 8u342 and 11.0.16 (July 2022 CPU update). This service is now provided by the Adoptium project, and users of upstream builds should now migrate to the equivalent Eclipse Temurin releases.
1 Like