How to configure eureka in docker

How to configure eureka in docker

eureka:

1. Build a JDK image

Start the eureka container

Prepare the jdk folder and all required files

mkdir ~/jdk
cd ~/jdk

#Upload jdk compressed file to /root/jdk/ directory# Pre-class materials/docker/tomcat7/jdk....gz
# Create Dockerfile

vim Dockerfile 

Copy the following content

java -jar a.jar --server.port=80 --spring.profiles.active=a

FROM centos:7
ADD jdk-8u212-linux-x64.tar.gz /opt/
ENV JAVA_HOME=/opt/jdk1.8.0_212 
  PATH=/opt/jdk1.8.0_212/bin:$PATH
ENTRYPOINT bash

Build:

docker build -t jdk:8 . 

docker images 

2. Build the eureka image

Prepare the eureka folder

mkdir ~/eureka
cd ~/eureka 

Upload the eureka jar file to the /root/eureka directory

Pre-course materials/DevOps pre-course materials/Kubernetes/K8s case/v2/eureka/eureka....jar

Create Dockerfile

vim Dockerfile

Copy the following content into Dockerfile

FROM jdk:8
COPY sp05-eureka-0.0.1-SNAPSHOT.jar /opt/
ENTRYPOINT ["java", "-jar", "/opt/sp05-eureka-0.0.1-SNAPSHOT.jar"]
CMD ["--spring.profiles.active=eureka1", "--server.port=2001"] 

Execute the build:

docker build -t eureka:v1 .
docker images 

If there is an eureka container before, clean it up first:

docker ps
docker rm -f xxx xxx xx 

docker container prune 

Start the eureka container:

docker run -d --name eureka1 \
-p 2001:2001 eureka:v1 

Print log:

docker logs eureka1 

Test address:

http://192.168.64.150:2001

This is the end of this article about how to configure eureka in docker. For more information about configuring eureka 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:
  • Detailed explanation of achieving high availability of eureka through docker and docker-compose

<<:  Implementation of vertical centering with unknown height in CSS

>>:  WeChat applet date and time component (year, month, day, hour, and minute)

Recommend

A brief understanding of the three uses of standard SQL update statements

1. Environment: MySQL-5.0.41-win32 Windows XP Pro...

MySQL 5.7.33 installation process detailed illustration

Table of contents Installation package download I...

Various correct postures for using environment variables in Webpack

Table of contents Write in front Business code us...

Detailed explanation of JavaScript progress management

Table of contents Preface question principle test...

MySQL 8.0.19 installation and configuration tutorial under Windows 10

I will be learning MySQL next semester. I didn...

Implementation of Vue counter

Table of contents 1. Implementation of counter 2....

JS realizes the card dealing animation

This article example shares the specific code of ...

A detailed introduction to wget command in Linux

Table of contents First install wget View Help Ma...

Introduction to keyword design methods in web design

Many times, we ignore the setting of the web page ...

CentOS7 deploys version 19 of docker (simple, you can follow it)

1. Install dependency packages [root@localhost ~]...

Detailed explanation of MySQL combined index method

For any DBMS, indexes are the most important fact...

How to publish static resources in nginx

step Place the prepared static resource files in ...

Detailed explanation of fs module and Path module methods in Node.js

Overview: The filesystem module is a simple wrapp...