Home  >  Article  >  Java  >  How to deploy springboot project to docker in idea

How to deploy springboot project to docker in idea

WBOY
WBOYforward
2023-05-17 08:04:351845browse

1. Idea to install docker plug-in

1. Installation

How to deploy springboot project to docker in idea

##2. Configuration

How to deploy springboot project to docker in idea

Note: To enable docker to be accessed through port 2375, you need to configure docker

vim /lib/systemd/system/docker.service
Modify as follows

How to deploy springboot project to docker in idea

3. Configure container

How to deploy springboot project to docker in idea

How to deploy springboot project to docker in idea

Dockerfile file (for convenience, the Dockerfile file is placed under the root directory)

FROM java:8
VOLUME /tmp
ADD /target/sso_test-0.0.1-SNAPSHOT.jar sso_test.jar
EXPOSE 9999
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/sso_test.jar"]
The format is FROM or FROM :.

The first instruction must be the FROM instruction. And, if you create multiple images in the same Dockerfile, you can use multiple FROM instructions (once for each image).

VOLUME

The format is VOLUME ["/data"].

Create a mount point that can be mounted from the local host or other containers. It is generally used to store databases and data that need to be maintained.

ADD

The format is ADD .

This command will copy the specified to in the container. Where can be a relative path to the directory where the Dockerfile is located; it can also be a URL; or it can be a tar file (automatically decompressed into a directory).

EXPOSE

The format is EXPOSE [...].

Tell Docker the port number exposed by the server container for use by the interconnected system. You need to pass -P when starting the container, and the Docker host will automatically assign a port and forward it to the specified port.

ENTRYPOINT

Two formats:

    ##ENTRYPOINT ["executable", "param1", "param2"]
  • ENTRYPOINT command param1 param2 (executed in shell)
  • Configure the command to be executed after the container is started, and cannot be overridden by the parameters provided by docker run.

Each Dockerfile can only have one ENTRYPOINT. When multiple are specified, only the last one will take effect.

Remarks:

To learn about Dockerfile, please move to----Dockerfile Introduction

Docker Chinese Manual-----Docker Chinese Manual

Deployment

The above is the detailed content of How to deploy springboot project to docker in idea. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete