It's quick to pull the java environment image on Docker Hub, but it's a memorandum I made because it has a detrimental personality that makes me feel uncomfortable unless I make it from scratch.
$ docker pull ubuntu
$ docker run -it ubuntu bash
After that, work on ubuntu
$ apt-get update
curl command
$ apt-get install curl
unzip command
$ apt-get install unzip
zip command
$ apt-get install zip
$ curl -s "https://get.sdkman.io" | bash
$ source "/root/.sdkman/bin/sdkman-init.sh"
Verification
$ 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
SDKMAN installation is complete
Check the java that can be installed
$ 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
================================================================================
Specify the java you want to install
$ sdk install java 8.0.232-open
Verification
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)
With the above, we have created a Java environment in Docker. The rest is boiled or baked.
Recommended Posts