Install Docker and create Java runtime environment

A memorandum that I thought I would try with Docker when building a Java execution environment on a new personal computer

environment

Docker installation

  1. Download Docker Toolbox [link] with VirtualBox and Kitematic.
  2. The Setup screen is OK with the default settings, confirm on the last screen and click [Install]
  3. When you start the shortcut of Docker Quickstart Terminal created on the desktop (such as > </ font> & # x1f40b;), various displays will be displayed, so wait.
  4. Complete when a whale picture appears like the image <img width = "656" alt = "2020-06-27 (1) .png " src = "https://qiita-image-store.s3.ap" -northeast-1.amazonaws.com/0/400039/20121d56-d7de-f30d-a410-875c38ebafb6.png ">
  5. Type docker run hello-world in the Docker terminal and press Enter to download the Docker image named" hello-world "<img width =" 656 "alt =" 2020-06-27 " (2) .png "src =" https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/400039/e1426465-5ef1-bb8e-577c-54dc8936727e.png ">

Download Docker image

You can enter commands in the terminal as it is, but this time I will download the Docker image using Kitematic which is easy to understand visually

  1. Launch Kitematic from a desktop shortcut
  2. Select [USE VIRTUALBOX] on the "Setup Initialization" screen, and you don't have to create a DockerHub account.
  3. Enter a keyword in the search box on the screen that appears after setup is complete (java this time)
  4. Select "openjdk" from the candidates that came out, and press the [CREATE] </ font> button <img width = "810" alt = "2020-06-27 (4) ) .png "src =" https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/400039/db9dd75e-755e-e8e2-d497-14a4d1052e92.png ">
  5. When "openjdk" is displayed in the Containers column on the left side and a gray icon is displayed like "hello-world" (downloaded from the terminal earlier), the download is complete.
** If "Connecting to Docker Hub" is displayed and the download does not proceed **

--Click DOCKER CLI </ font> at the bottom left of the image above to launch PowerShell. --Type docker pull scraping hub / splash and Enter --After waiting for a while, various downloads have been completed, so when you return to Kitematic in this state, the downloads have been completed. --If it doesn't work, stop downloading the Docker image and try downloading again by pressing the [CREATE] </ font> button </ div> </ details>

Create a container from a Docker image

When I tried to do this with Kitematic, no matter how many times I clicked [START], it stopped immediately, so I went back to the Docker terminal and worked on it.

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

Recommended Posts