preface

Deploy local common SpringCloud projects under IDEA using Docker

The environment

  • Windows 10
  • IntelliJ IDEA 2018
  • Docker 18.09.2

Local connections do not require TLS encryption

Set the connection between docker and local to not require TLS encryption

IDEA Install Docker plug-in

Configure the connection to the local Docker

Connection Successful connected to docker!

Open a local SpringCloud project

This is a multi-module project that previously learned from SpringCloud, testing the deployment of the sub-module Eureka-Server on a local Docker

Add the Dockerfile file to the project root directory

FROM java:8

Persist to the specified directory
VOLUME /tmp

# copy the project jar package (Eureka-service-1.0-snapshot.jar) to app.jar
COPYThe target/eureka - server - 1.0 - the SNAPSHOT. Jar app. The jar
RUN bash  -c "touch /app.jar"

EXPOSE  8761
Egd =file:/dev/./urandom

ENTRYPOINT ["java"."-Djava.security.egd=file:/dev/./urandom"."-jar"."/app.jar"]
Copy the code

Configuration Edit Docker Deployment Configuration

Port mapping

Mount the directory

Build the Docker image

Local image, container successfully created

View detailed configuration information

Access the Eureka service started through the container

View the running container