10

When I look at package lists they suggest that all sorts of Java 8 packages exist for Alpine, but when I try to install them I always get:

apk add openjdk8
ERROR: unsatisfiable constraints:
  openjdk8-jre (missing):
    required by: world[openjdk8]

And this also happens with other Java 8 packages, such as openjdk8-jre.

According to this: https://pkgs.alpinelinux.org/packages?name=openjdk8&branch=v3.10&arch=x86_64 the package exists for version 3.10 64 bit, which I'm using, so why wouldn't it install?

Maxim
  • 728
  • 3
  • 12
  • 22
  • 1
    Could you post the contents of `/etc/apk/repositories`? – valiano Dec 13 '19 at 06:56
  • 1
    @valiano After looking at that file, I noticed that most repos were commented out, after uncommenting them "openjdk8" installed, thanks – Maxim Dec 13 '19 at 16:25

2 Answers2

8

openjdk is in the community repo. It seems that you didn't enable community repo. Go ahead and first enable community repo by uncommenting the community repo in /etc/apk/repositories, then run apk update then execute apk add openjdk11.

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
  • Seems to be what [solved the OP's problem](https://unix.stackexchange.com/questions/556962/how-to-install-java-8-on-alpine-linux/577486#comment1034884_556962) – Jeff Schaller Apr 02 '20 at 12:02
4

Try another version of openJdk8:

RUN apk add openjdk8=8.242.08-r0