Home  >  Article  >  Operation and Maintenance  >  How to manually download and install jdk in docker?

How to manually download and install jdk in docker?

coldplay.xixi
coldplay.xixiOriginal
2020-07-22 15:15:044283browse

How to manually download and install jdk with docker: first place the tar package in the docker folder and create a new folder share in the root directory; then start docker and load the docker image; finally start the container and enter 【/share】path, just decompress the jdk installation package.

How to manually download and install jdk in docker?

How to manually download and install jdk with docker:

1. Environment preparation

1, Linux operating system that has already installed docker

2, download jdk-8u172-linux-x64.tar.gz jdk1.8 installation package

3, download centos- 7-86_64.tar.gz centos-7 operating system image template

2, installation steps

1, centos-7-86_64.tar.gz Place it in the docker folder in the system root directory.

2. Create a new folder share in the root directory and place jdk-8u172-linux-x64.tar.gz under this folder.

3, start docker:

service docker start

4, load the docker image based on the local template, execute

docker load --input centos-7-86_64.tar.gz

5 under the docker file, after the image is successfully loaded, it can be executed docker images View local image information.

6, start the container:

docker run -ti -v /share:/share centos:v0.1 --name centos7 /bin/bash 此时在centos:v0.1

Based on the image, a container named centos7 was run interactively and a host directory was mounted /share As a data volume, the corresponding directory in the container is also /share.

7. After the container is started, enter the /share path and you can get the local ## Unzip the jdk installation package in the #/share directory to a custom path, and then configure the environment variables. After the configuration is completed, execute java -version in the container. After the version information appears, the JDK installation is successful.

Related tutorial recommendations:

docker tutorial

The above is the detailed content of How to manually download and install jdk in docker?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What does docker do?Next article:What does docker do?