How to turn a jar package into a docker container 1. First download the java image docker pull java:8 2. Create a new working directory and copy the jar package into it mkdir mydocker cd mydocker copy /xxx/app.jar ./ 3. Create a new Dockerfile vi Dockerfile The file contents are as follows: FROM java:8 MAINTAINER freebytes.net WORKDIR /test COPY app.jar /test/app.jar CMD ["java","-jar","app.jar","-Dfile.encoding=utf-8"] Code Explanation
4. Build an image docker build -t app-docker . Indicates building an image from the current directory. This command will package all the files in the current directory and send them to the Docker engine server, and then build the image according to the Dockerfile on the server. 5. After the build is successful, start the container docker run -it -p 9013:8088 –name app -d my-docker According to the Dockerfile configuration just now, after the container is generated, a test directory will inevitably be generated in the container root directory, and the app.jar file will exist in the test directory. The container executes the instructions defined by CMD based on the test directory. Can enter the container to view docker exec -it app /bin/bash This is the end of this article about how to turn a jar package into a docker container. For more information about how to turn a jar package into a docker container, 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:
|
<<: Solve MySQL login error: 'Access denied for user 'root'@'localhost'
>>: Detailed explanation of the abbreviation of state in react
In HTML, the <img> tag is used to define an...
The nginx configuration is as follows: Such as ht...
Preface: In project development, some business ta...
As shown below: select a1,a2,a1+a2 a,a1*a2 b,a1*1...
Sometimes the theme of a project cannot satisfy e...
This article shares with you a practical web navi...
This axios package is used in the vue3 demo. For ...
I often see some circular wave graphics on mobile...
This script can satisfy the operations of startin...
Prepare the bags Install Check if Apache is alrea...
background A specific device is used to perform i...
Introduction to MySQL Window Functions MySQL has ...
Table of contents Overview How to achieve it Spec...
Component Basics 1 Component Reuse Components are...
Table of contents 1. substring() 2. substr() 3.in...