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 analysis of the basic concepts of HTML web pages

What is a web page? The page displayed after the ...

HTML Tutorial: Collection of commonly used HTML tags (6)

Related articles: Beginners learn some HTML tags ...

Seven Principles of a Skilled Designer (2): Color Usage

<br />Previous article: Seven Principles of ...

This article will show you how JavaScript garbage collection works

Table of contents 1. Overview 2. Memory Managemen...

Quickly solve the problem that the mysql57 service suddenly disappeared

one, G:\MySQL\MySQL Server 5.7\bin> mysqld --i...

How to use indexes to optimize MySQL ORDER BY statements

Create table & create index create table tbl1...

vue+element custom query component

This article mainly introduces the Vue project. O...

Detailed installation tutorial of Mysql5.7.19 under Centos7

1. Download Download mysql-5.7.19-linux-glibc2.12...

Historical Linux image processing and repair solutions

The ECS cloud server created by the historical Li...

CentOS IP connection network implementation process diagram

1. Log in to the system and enter the directory: ...

A brief discussion on the synchronization solution between MySQL and redis cache

Table of contents 1. Solution 1 (UDF) Demo Case 2...

CSS to achieve Cyberpunk 2077 style visual effects in a few steps

background Before starting the article, let’s bri...

Three ways to refresh iframe

Copy code The code is as follows: <iframe src=...