How to install openjdk in docker and run the jar package

How to install openjdk in docker and run the jar package

Download image

docker pull openjdk

Creating a Data Volume

Create a java_app data volume

docker volume create java_app

Upload jar package to /var/lib/docker/volumes/java_app/_data/ and start the image

Start the image

docker run --name=javaApp --restart=always --network=host \
 -v java_app:/usr/src/myapp openjdk java -jar /usr/src/myapp/jar package

For example

docker run -it -d --network=host --restart=always --name=autoRefreshCSDN -v java_app:/usr/src/myapp openjdk java -jar /usr/src/myapp/autoRefreshCSDN-1.0-SNAPSHOT-jar-with-dependencies.jar

This is the end of this article about how to install openjdk in docker and run the jar package. For more information about running jar packages in docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • OpenJDK source code debugging tutorial
  • How to replace OpenJDK with Oracle JDK in Kylin V10
  • Docker solves the problem that JDK's jmap and other commands cannot be used in openjdk containers
  • Differences between openjdk and Oraclejdk
  • How to uninstall Linux's native openjdk and install sun jdk
  • How to easily compile openJDK in Ubuntu
  • Compilation details based on the compiled virtual machine jvm-openjdk
  • A quick solution to the problem of being unable to uninstall after installing openJDK1.8 with yum
  • How to install Java openjdk on CentOS system
  • Detailed explanation of System.out.println in OpenJDK source code analysis

<<:  Vue implements the browser-side code scanning function

>>:  HTML table markup tutorial (29): cell light border color attribute BORDERCOLORLIGHT

Recommend

Detailed explanation of firewall rule settings and commands (whitelist settings)

1. Set firewall rules Example 1: Expose port 8080...

A complete guide to CSS style attributes css() and width() in jQuery

Table of contents 1. Basic use of css(): 1.1 Get ...

Detailed explanation of the difference between run/cmd/entrypoint in docker

In Dockerfile, run, cmd, and entrypoint can all b...

Oracle VM VirtualBox installation of CentOS7 operating system tutorial diagram

Table of contents Installation Steps Environment ...

Customization Method of Linux Peripheral File System

Preface Generally speaking, when we talk about Li...

HTML&CSS&JS compatibility tree (IE, Firefox, Chrome)

What is a tree in web design? Simply put, clicking...

Detailed steps to build an independent mail server on Centos7.9

Table of contents Preface 1. Configure intranet D...

About if contains comma expression in JavaScript

Sometimes you will see English commas ",&quo...

How to build Nginx image server with Docker

Preface In general development, images are upload...

9 super practical CSS tips to help designers and developers

A web designer's head must be filled with a lo...

Window.name solves the problem of cross-domain data transmission

<br />Original text: http://research.microso...

Implementation of element shuttle frame performance optimization

Table of contents background Solution New Questio...

Detailed explanation of Vue-router nested routing

Table of contents step 1. Configure routing rules...