젠투 도커 이미지에 Java를 설치하는 방법

젠투 도커 이미지에 Java를 설치하는 방법

젠투 도커 이미지가 있습니다. 컨테이너 내부에 Java 8을 설치하려고 합니다. 웹에 튜토리얼이 있지만 도움이 되지 않았습니다.

나는 실행하려고했습니다 :

emerge  --verbose dev-java/icedtea-bin:8

그러나 다음과 같은 결과가 나왔습니다.

The following USE changes are necessary to proceed:
 (see "package.use" in the portage(5) man page for more details)
# required by net-print/cups-filters-1.21.6::gentoo[postscript]
# required by net-print/cups-2.2.7::gentoo
# required by dev-java/icedtea-bin-3.10.0-r1::gentoo[cups,-multilib]
# required by virtual/jdk-1.8.0-r3::gentoo
# required by virtual/jre-1.8.0-r1::gentoo
# required by dev-java/icedtea-web-1.6.2::gentoo
>=app-text/ghostscript-gpl-9.26 cups

Use --autounmask-write to write changes to config files (honoring
CONFIG_PROTECT). Carefully examine the list of proposed changes,
paying special attention to mask or keyword changes that may expose
experimental or unstable packages.

답변1

다음과 같이 tar.gz 아카이브를 다운로드하여 설치할 수 있습니다.

...
RUN wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz \
 && mkdir /opt/jdk \
 && tar zxf jdk-8u131-linux-x64.tar.gz -C /opt/jdk \
 && update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_131/bin/java 100 \
 && update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_131/bin/javac 100 \
 && update-alternatives --display java \
 && update-alternatives --display javac \
 && rm -rf jdk-8u131-linux-x64.tar.gz
...

답변2

RUN wget -c --header "쿠키: oraclelicense=accept-securebackup-cookie"http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz RUN mkdir /opt/jdk RUN tar zxf jdk-8u131-linux-x64.tar.gz -C /opt/jdk ENV PATH=$PATH:/opt/jdk/jdk1.8.0_131/bin

관련 정보