[Java] Install Docker and create Java execution environment

1 minute read

When building a Java execution environment on a new personal computer, a memorandum I thought I would try with Docker

Environment

  • Windows 10 Home (64bit)

Install Docker

  1. Download Docker Toolbox [link] including VirtualBox and Kitematic
  2. The default settings on the Setup screen are OK. Confirm on the last screen and click [Install].
  3. When you launch the Docker Quickstart Terminal shortcut created on your desktop (such as >🐋), it will be displayed in various ways. Wait.
  4. Complete when a whale picture appears like an image 2020-06-27 (1).png
  5. Enter docker run hello-world in the Docker terminal and press Enter. A Docker image named “hello-world” will be downloaded. 2020-06-27 (2).png

Download Docker image

You can also enter commands in the terminal as it is, but this time try downloading the Docker image using Kitematic that is visually easy to understand

  1. Start Kitematic from the desktop shortcut
  2. Select [USE VIRTUALBOX] on the “Setup Initialization” screen and do not need to create a DockerHub account.
  3. Enter the keyword in the search box on the screen displayed after setup is complete (this time, java)
  4. Select “openjdk” this time from the candidates that appeared and press the [CREATE] button 2020-06-27 (4 ).png
  5. When “openjdk” is displayed in the Containers column on the left side and the gray icon is displayed like “hello-world” (downloaded from the terminal earlier), the download is completed.
** When "Connecting to Docker Hub" is displayed and download does not proceed **
- Click DOCKER CLI at the bottom left of the image above to start PowerShell - Type `docker pull scrapinghub/splash` and press Enter - Waiting for a while, various downloads are completed, so when I returned to Kitematic in this state, the download was completed - If it doesn't work, stop downloading the Docker image and try again by pressing the [CREATE] button

Create a container from a Docker image

When I wanted to do this with Kitematic as well, it stopped immediately after I clicked [START] many times, so I returned to the Docker terminal and started working.

  1. Execute docker run -it --name testcont openjdk:latest to create a container in a running state (“testcont” is the name of the container)
  2. Complete!