Il est rapide d'extraire l'image de l'environnement java sur DockerHub, mais c'est un mémorandum que j'ai rédigé car il a une personnalité préjudiciable à moins que je ne le fasse à partir de zéro.
$ docker pull ubuntu
$ docker run -it ubuntu bash
Après cela, travaillez avec ubuntu
$ apt-get update
commande curl
$ apt-get install curl
commande décompresser
$ apt-get install unzip
commande zip
$ apt-get install zip
$ curl -s "https://get.sdkman.io" | bash
$ source "/root/.sdkman/bin/sdkman-init.sh"
Vérification
$ sdk help
==== BROADCAST =================================================================
* 2020-01-08: Asciidoctorj 2.2.0 released on SDKMAN! #asciidoctorj
* 2020-01-07: Gradle 6.1-rc-2 released on SDKMAN! #gradle
* 2020-01-06: Jbang 0.4.0.1 released on SDKMAN! #jbang
================================================================================
Usage: sdk <command> [candidate] [version]
sdk offline <enable|disable>
commands:
install or i <candidate> [version] [local-path]
uninstall or rm <candidate> <version>
list or ls [candidate]
use or u <candidate> <version>
default or d <candidate> [version]
current or c [candidate]
upgrade or ug [candidate]
version or v
broadcast or b
help or h
offline [enable|disable]
selfupdate [force]
update
flush <broadcast|archives|temp>
candidate : the SDK to install: groovy, scala, grails, gradle, kotlin, etc.
use list command for comprehensive list of candidates
eg: $ sdk list
version : where optional, defaults to latest stable if not provided
eg: $ sdk install groovy
local-path : optional path to an existing local installation
eg: $ sdk install groovy 2.4.13-local /opt/groovy-2.4.13
L'installation de SDKMAN est terminée
Vérifiez le java qui peut être installé
$ sdk list java
================================================================================
Available Java Versions
================================================================================
Vendor | Use | Version | Dist | Status | Identifier
--------------------------------------------------------------------------------
AdoptOpenJDK | | 13.0.1.j9 | adpt | | 13.0.1.j9-adpt
| | 13.0.1.hs | adpt | | 13.0.1.hs-adpt
| | 12.0.2.j9 | adpt | | 12.0.2.j9-adpt
| | 12.0.2.hs | adpt | | 12.0.2.hs-adpt
| | 11.0.5.j9 | adpt | | 11.0.5.j9-adpt
| >>> | 11.0.5.hs | adpt | installed | 11.0.5.hs-adpt
| | 8.0.232.j9 | adpt | | 8.0.232.j9-adpt
| | 8.0.232.hs | adpt | | 8.0.232.hs-adpt
Amazon | | 11.0.5 | amzn | | 11.0.5-amzn
| | 8.0.232 | amzn | | 8.0.232-amzn
Azul Zulu | | 13.0.1 | zulu | | 13.0.1-zulu
| | 12.0.2 | zulu | | 12.0.2-zulu
| | 11.0.5 | zulu | | 11.0.5-zulu
| | 10.0.2 | zulu | | 10.0.2-zulu
| | 9.0.7 | zulu | | 9.0.7-zulu
| | 8.0.232 | zulu | | 8.0.232-zulu
| | 7.0.242 | zulu | | 7.0.242-zulu
| | 6.0.119 | zulu | | 6.0.119-zulu
Azul ZuluFX | | 11.0.2 | zulufx | | 11.0.2-zulufx
| | 8.0.202 | zulufx | | 8.0.202-zulufx
BellSoft | | 13.0.1 | librca | | 13.0.1-librca
| | 12.0.2 | librca | | 12.0.2-librca
| | 11.0.5 | librca | | 11.0.5-librca
| | 8.0.232 | librca | | 8.0.232-librca
GraalVM | | 19.3.0.r11 | grl | | 19.3.0.r11-grl
| | 19.3.0.r8 | grl | | 19.3.0.r8-grl
| | 19.3.0.2.r11 | grl | | 19.3.0.2.r11-grl
| | 19.3.0.2.r8 | grl | | 19.3.0.2.r8-grl
| | 19.2.1 | grl | | 19.2.1-grl
| | 19.1.1 | grl | | 19.1.1-grl
| | 19.0.2 | grl | | 19.0.2-grl
| | 1.0.0 | grl | | 1.0.0-rc-16-grl
Java.net | | 15.ea.4 | open | | 15.ea.4-open
| | 14.ea.30 | open | | 14.ea.30-open
| | 13.0.1 | open | | 13.0.1-open
| | 12.0.2 | open | | 12.0.2-open
| | 11.0.5 | open | | 11.0.5-open
| | 10.0.2 | open | | 10.0.2-open
| | 9.0.4 | open | | 9.0.4-open
| | 8.0.232 | open | | 8.0.232-open
SAP | | 12.0.2 | sapmchn | | 12.0.2-sapmchn
| | 11.0.4 | sapmchn | | 11.0.4-sapmchn
================================================================================
Use the Identifier for installation:
$ sdk install java 11.0.3.hs-adpt
================================================================================
Spécifiez le java que vous souhaitez installer
$ sdk install java 8.0.232-open
Vérification
root@d9b652b0db21:/# java -version
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (build 1.8.0_232-b09)
OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode)
Avec ce qui précède, nous avons créé un environnement Java dans Docker. Le reste est bouilli ou cuit au four.