[JAVA] Create a Docker container image with JRE8 / JDK8 on Amazon Linux

background

JRE container image creation

Dockerfile


FROM amazonlinux:2.0.20181114
RUN yum install -y java-1.8.0-openjdk-headless && yum clean all
#Create a Docker container image
$ docker build -t amazonlinux-jre8 .
(abridgement)

#(For confirmation) Enter the container with ssh and check the version
$ docker run -it amazonlinux-jre8 sh
sh-4.2# java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
sh-4.2# javac -version
sh: javac: command not found

JDK container image creation

Dockerfile


FROM amazonlinux:2.0.20181114
RUN yum install -y java-1.8.0-openjdk-devel && yum clean all
#Create a Docker container image
$ docker build -t amazonlinux-jdk
(abridgement)

#(For confirmation) Enter the container with ssh and check the version
$ docker run -it amazonlinux-jdk sh
sh-4.2# java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
sh-4.2# javac -version
javac 1.8.0_191

Check size

$ docker images --format "table {{.Repository}}\t{{.Size}}" | grep amazonlinux
amazonlinux                  162MB
amazonlinux-jre8             308MB
amazonlinux-jdk              362MB

Summary

Recommended Posts

Create a Docker container image with JRE8 / JDK8 on Amazon Linux
[Linux] Build a Docker environment with Amazon Linux 2
Launch Django on a Docker container with docker-compose up
[AWS Lambda] Create a deployment package using the Docker image of Amazon Linux
[Linux] Create a self-signed certificate with Docker and apache
Create a VS Code + Docker development environment on a Linux VM
Run Matplotlib on a Docker container
Create a Linux environment on Windows 10
Building a Python3 environment with Amazon Linux2
Create a dummy image with Python + PIL.
[Linux] Build a jenkins environment with Docker
Create a Linux virtual machine on Windows
[Golang] Create docker image with Github Actions
Create a web service with Docker + Flask
Run matplotlib on a Windows Docker container
Procedure for building a kube environment on amazon linux2 (aws) ~ (with bonus)
Run a batch of Python 2.7 with nohup on Amazon Linux AMI on EC2
Create a permanent write area on Kali Linux with USB memory boot
Start a process with a scheduling policy on Linux
Try to create a new command on linux
Put Python3 in Docker container of Amazon Linux2
Install PHP 7 series on Amazon Linux 2 with Amazon Linux Extras
Create Amazon Linux with AWS EC2 and log in
Create a QR code for the URL on Linux
Set up Docker on Oracle Linux (7.x) with Vagrant
How to create a Python 3.6.0 environment by putting pyenv on Amazon Linux and Ubuntu
Create an environment for MkDocs on Amazon Linux (attempted)
Create a Layer for AWS Lambda Python with Docker
Carry a Docker container
[kotlin] Create a real-time image recognition app on android
How to build a Python environment on amazon linux 2
Steps to create a Job that pulls a Docker image and tests it with Github Actions
Install LAMP on Amazon Linux 2 and build a WordPress environment.
Create a new csv with pandas based on the local csv
Linux beginners create Ubuntu 16.04 environment on Docker (for Mac)-first half-
Create a list in Python with all followers on twitter
[Django] Build a Django container (Docker) development environment quickly with PyCharm
Create a simple Python development environment with VSCode & Docker Desktop
Create a GCE instance from a GCR Docker image using terraform
Create a Todo app with Django ① Build an environment with Docker
How to create an ISO file (CD image) on Linux
Get the host name of the host PC with Docker on Linux
Install the JDK on Linux
Create Image Viewer with Tkinter
Install tomcat 5.5 on Amazon Linux.
Create a heatmap with pyqtgraph
Create a classroom on Jupyterhub
Use sshpass on Amazon linux2
Install Homebrew on Amazon Linux 2
Install strongSwan 5.9.1 on Amazon Linux 2
Create a directory with python
[MariaDB] Install MariaDB on Linux and create a DB and an operating user.
I tried to create an environment of MkDocs on Amazon Linux
Build a Selenium environment on Amazon Linux 2 in the shortest time
Create a word cloud with only positive / negative words on Twitter
Create a development environment for Go + MySQL + nginx with Docker (docker-compose)
Create a C ++ and Python execution environment with WSL2 + Docker + VSCode
Create a simple Python development environment with VS Code and Docker
How to easily create a CG image like a toy photo "Ubuntu / Linux" ・ Photo realistic rendering with LeoCAD & Blender
Since the dokcer image (1GB) of OpenJDK11 is large, create a small image (85MB) with alpine linux + jlink.
A note for me that I can't add an external repository with rpm --import on Amazon Linux2