A
A
Artem Ryzhov2020-06-12 14:28:49
Java
Artem Ryzhov, 2020-06-12 14:28:49

How to install java in docker?

Hello.

To minify js and css files, I added java to the image:

FROM webdevops/php-apache-dev:7.3

RUN apt-get update && apt-get install -y --no-install-recommends apt-utils software-properties-common

# Install OpenJDK-8
RUN apt-get update && \
    mkdir -p /usr/share/man/man1 && \
    apt-get install -y openjdk-8-jdk && \
    apt-get install -y ant && \
    apt-get clean

# Fix certificate issues
RUN apt-get update && \
    apt-get install ca-certificates-java && \
    apt-get clean && \
    update-ca-certificates -f

# Setup JAVA_HOME -- useful for docker commandline
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
RUN export JAVA_HOME


Used to do it, now it's gone. It gives an error:

E: Unable to locate package openjdk-8-jdk

I understand that this is related to the license https://github.com/mvberg/ib-gateway-docker/issues/10

How can I use java in docker now? How to fix Dockerfile?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2020-06-12
@ryzhovas

Issue which you resulted is connected with the license. Your problem is no. There is an error because of the oracle package, you are trying to install openjdk.
Find out why the package is not available. Maybe the name has changed, maybe something else ..

L
Lane Cube, 2020-07-05
@leinariys

Use layers where there is java
FROM openjdk:8-jre
COPY ./parser/bin /parser
USER root
ENTRYPOINT ["/parser"]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question