[Note] Create a java environment from scratch with docker

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.

environment

procedure

1. Get ubuntu image

$ docker pull ubuntu

2. Start ubuntu container

$ docker run -it ubuntu bash

After that, work on ubuntu

3. Update the apt-get command

$ apt-get update

4. Install the minimum required commands

curl command

$ apt-get install curl

unzip command

$ apt-get install unzip

zip command

$ apt-get install zip

5. Install sdkman

$ 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

6. Java installation

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

[Note] Create a java environment from scratch with docker
Create a MySQL environment with Docker from 0-> 1
Create a Vue3 environment with Docker!
[Memo] Create a CentOS 8 environment easily with Docker
[Windows] [IntelliJ] [Java] [Tomcat] Create a Tomcat9 environment with IntelliJ
Prepare a scraping environment with Docker and Java
Create a Spring Boot development environment with docker
Create a java web application development environment with docker for mac part2
[Note] Build a Python3 environment with Docker in EC2
Create SolrCloud verification environment with Docker
Create Laravel environment with Docker (docker-compose)
I tried to create a java8 development environment with Chocolatey
I tried to create a padrino development environment with Docker
Create a web environment quickly using Docker
Build a PureScript development environment with Docker
Create Rails 6 + MySQL environment with Docker compose
Build a WAS execution environment from Docker
Build a Wordpress development environment with Docker
Install Docker and create Java runtime environment
Creating a java web application development environment with docker for mac part1
Create a Privoxy + Tor environment instantly using Docker
Make SpringBoot1.5 + Gradle4.4 + Java8 + Docker environment compatible with Java11
Create a simple bulletin board with Java + MySQL
Let's create a timed process with Java Timer! !!
Build a Laravel / Docker environment with VSCode devcontainer
Build a WordPress development environment quickly with Docker
[Java] Create a collection with only one element
Create Scala Seq from Java, make Scala Seq a Java List
Build a development environment for Docker, java, vscode
Create a docker environment for Oracle 11g XE
Build a Java development environment with VS Code
[Java] Create a filter
Build a development environment to create Ruby on Jets + React apps with Docker
Create a Java development environment using jenv on Mac
Create a docker image that runs a simple Java app
How to create a Java environment in just 3 seconds
Build VS Code + WSL + Java + Gradle environment from scratch
[Beginner] Create a competitive game with basic Java knowledge
Easily build a Vue.js environment with Docker + Vue CLI
Call a method with a Kotlin callback block from Java
Build Java development environment with WSL2 Docker VS Code
Create a Java, JavaScript team development environment (problem raising)
[Environment construction] Build a Java development environment with VS Code!
Try to build a Java development environment using Docker
Creating a lightweight Java environment that runs on Docker
Create Chisel development environment with Windows10 + WSL2 + VScode + Docker
Create a Java (Gradle) project with VS Code and develop it on a Docker container
Docker command to create Rails project with a single blow in environment without Ruby
Create a Java (Maven) project with VS Code and develop it on a Docker container
Pytorch execution environment with Docker
A note about Java GC
Create a java method [Memo] [java11]
[Java] Create a temporary file
Create a playground with Xcode 12
Build docker environment with WSL
Java life starting from scratch
Using Docker from Java Gradle
React environment construction with Docker
Study Java with Progate Note 1
Docker × Java Building a development environment that is too simple
Deploying a Java environment with Windows Subsystem for Linux (WSL)