• Dockerfile 及其常见指令介绍
  • maven 插件打包镜像
  • Eureka Server 微服务运行在容器中

 https://github.com/spotify/docker-maven-plugin

Dockerfile 及其常见指令介绍

Dockerfile 其实一个文本文件,其中包含了若干个符合 Docker 解析规范的指令,指令描述了构建镜像的步骤或者一些细节。

Nginx 小例子

首先,我们新建一个简单的 Dockerfile,文件名就叫做Dockerfile,其内容如下:

1
2
FROM nginx
RUN echo '<h1>SpringCloud-Docker</h1>' > /usr/share/nginx/html/index.html

上面的 Dockerfile 基于 nginx 镜像修改了 index.html 首页,首页显示SpringCloud-Docker内容。

我们可以通过 Docker 来构建此镜像并运行:

tom@ubuntu:~/Desktop/3/docker1$ sudo docker build -t nginx-demo .
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM nginx
latest: Pulling from library/nginx
45b42c59be33: Pull complete
8acc495f1d91: Pull complete
ec3bd7de90d7: Pull complete
19e2441aeeab: Pull complete
f5a38c5f8d4e: Pull complete
83500d851118: Pull complete
Digest: sha256:f3693fe50d5b1df1ecd315d54813a77afd56b0245a404055a946574deb6b34fc
Status: Downloaded newer image for nginx:latest
---> 35c43ace9216
Step 2/2 : RUN echo '<h1>SpringCloud-Docker</h1>' > /usr/share/nginx/html/index.html
---> Running in c8bb31f5043d
Removing intermediate container c8bb31f5043d
---> 16e25cfdf65d
Successfully built 16e25cfdf65d
Successfully tagged nginx-demo:latest

tom@ubuntu:~/Desktop/3/docker1$ sudo docker run -p 8080:80 nginx-demo
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
192.168.154.1 - - [21/Feb/2021:08:18:51 +0000] "GET / HTTP/1.1" 200 28 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-"
2021/02/21 08:18:51 [error] 31#31: *1 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 192.168.154.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "192.168.154.131:8080", referrer: "http://192.168.154.131:8080/"
192.168.154.1 - - [21/Feb/2021:08:18:51 +0000] "GET /favicon.ico HTTP/1.1" 404 555 "http://192.168.154.131:8080/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-"

 

 

随后访问http://localhost:8080得到如下响应:

图片描述

或者控制台执行如下指令:

curl localhost:8080
响应如下:
<h1>SpringCloud-Docker</h1>
常见指令
1
2
3
4
5
6
7
8
9
10
11
12
上面的 Dockerfile 提到了 FROM、RUN 指令。事实上,Dockerfile 有十多个指令,一般格式是:指令名称 参数。
 
FROM 指定基础镜像:FROM <image>:<tag>
比如基于 Java JDK 环境的镜像:openjdk:8-jre-alpine:latest
 
ADD 复制文件:ADD <src> <dest>
从src目录复制文件到容器的dest目录,其中 src 可以是 Dockerfile 所在目录的相对路径,也可以是一个 URL,还可以是一个压缩包。
 
COPY 复制文件:COPY <src> <dest>
COPY 和 ADD 指令类似,COPY 不支持 URL 的压缩包。
 
ENTRYPOINT 入口点:ENTRYPOINT command param1 param2

  

指定 Docker 容器启动时执行的命令。

更多指令可以参考官方文档,这里不一一讲解。接下来开始对我们前面的 Eureka Server 微服务进行改造,使其运行在 Docker 容器中。

 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
INFO: Retrying request to {}->unix://localhost:80
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  34.749 s
[INFO] Finished at: 2021-02-21T01:07:17-08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.8:build (default-cli) on project findservice: Could not build image: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: Permission denied -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException<br><br><pluginGroup>com.spotify</pluginGroup><br><br><br>Caused by: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: Permission denied<br><br>使用root用户执行

[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.8:build (default-cli) on project findservice: Could not build image: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: Permission denied -> [Help 1]

 

 

 No plugin found for prefix 'dockerfile' in the current project and in the plugin groups [org.apache

 

错误原因:
插件不在maven配置文件settings.xml中pluginGroups的白名单里面

解决方法:
修改maven的settings.xml配置文件,在<pluginGroups>节点中添加

[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.8:build (default-cli) on project findservice: Could not build image: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: Permission denied -> [Help 1]

 

 

mvn clean package -DskipTests && mvn dockerfile:build

 

  

 

Dockerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
cat Dockerfile
FROM openjdk:8-jre-alpine
 
LABEL maintainer="tanjian@apache.org"
 
ENV TZ=Asia/Shanghai \
    DIST_NAME=findservice-1.0-SNAPSHOT
 
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime \
    && echo $TZ > /etc/timezone
 
COPY target/"$DIST_NAME.jar" /"$DIST_NAME.jar"
 
EXPOSE 8761
 
ENTRYPOINT java $JAVA_OPTS -jar /$DIST_NAME.jar

  

pom.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<build>
        <plugins>
            <!-- 添加spring-boot的maven插件,不能少,打jar包时得用 -->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
 
            </plugin><plugin>
            <groupId>com.spotify</groupId>
            <artifactId>dockerfile-maven-plugin</artifactId>
            <version>1.4.8</version>
         
            <configuration>
                 <repository>eureka-server</repository>
                 <version>1.0</version>
              </configuration>
        </plugin>
 
        </plugins>
    </build>

  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
root@ubuntu:/home/tom/Desktop/3/docker2/findservice# mvn clean package -DskipTests && mvn  dockerfile:build
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.lzj1234:findservice >-----------------------
[INFO] Building findservice 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ findservice ---
[INFO] Deleting /home/tom/Desktop/3/docker2/findservice/target
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ findservice ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ findservice ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/tom/Desktop/3/docker2/findservice/target/classes
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ findservice ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ findservice ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.21.0:test (default-test) @ findservice ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ findservice ---
[INFO] Building jar: /home/tom/Desktop/3/docker2/findservice/target/findservice-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.0.7.RELEASE:repackage (default) @ findservice ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.448 s
[INFO] Finished at: 2021-02-21T02:47:48-08:00
[INFO] ------------------------------------------------------------------------
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.lzj1234:findservice >-----------------------
[INFO] Building findservice 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- dockerfile-maven-plugin:1.4.8:build (default-cli) @ findservice ---
^Croot@ubuntu:/home/tom/Desktop/3/docker2/findservice# vim pom.xml
root@ubuntu:/home/tom/Desktop/3/docker2/findservice# mvn clean package -DskipTests && mvn  dockerfile:build
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.lzj1234:findservice >-----------------------
[INFO] Building findservice 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ findservice ---
[INFO] Deleting /home/tom/Desktop/3/docker2/findservice/target
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ findservice ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ findservice ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/tom/Desktop/3/docker2/findservice/target/classes
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ findservice ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ findservice ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.21.0:test (default-test) @ findservice ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ findservice ---
[INFO] Building jar: /home/tom/Desktop/3/docker2/findservice/target/findservice-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.0.7.RELEASE:repackage (default) @ findservice ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.383 s
[INFO] Finished at: 2021-02-21T02:48:13-08:00
[INFO] ------------------------------------------------------------------------
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.lzj1234:findservice >-----------------------
[INFO] Building findservice 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- dockerfile-maven-plugin:1.4.8:build (default-cli) @ findservice ---
[INFO] Building Docker context /home/tom/Desktop/3/docker2/findservice
[INFO]
[INFO] Image will be built as eureka-server:latest
[INFO]
[INFO] Step 1/7 : FROM openjdk:8-jre-alpine
[INFO]
[INFO] Pulling from library/openjdk
[INFO] Digest: sha256:f362b165b870ef129cbe730f29065ff37399c0aa8bcab3e44b51c302938c9193
[INFO] Status: Image is up to date for openjdk:8-jre-alpine
[INFO]  ---> f7a292bbb70c
[INFO] Step 2/7 : LABEL maintainer="tanjian@apache.org"
[INFO]
[INFO]  ---> Using cache
[INFO]  ---> e7fb1f5df4fa
[INFO] Step 3/7 : ENV TZ=Asia/Shanghai     DIST_NAME=findservice-1.0-SNAPSHOT
[INFO]
[INFO]  ---> Using cache
[INFO]  ---> 68b2a487c19f
[INFO] Step 4/7 : RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime     && echo $TZ > /etc/timezone
[INFO]
[INFO]  ---> Using cache
[INFO]  ---> a6bd28b0cbb0
[INFO] Step 5/7 : COPY target/"$DIST_NAME.jar" /"$DIST_NAME.jar"
[INFO]
[INFO]  ---> 66babf7839e9
[INFO] Step 6/7 : EXPOSE 8761
[INFO]
[INFO]  ---> Running in f41a964b97de
[INFO] Removing intermediate container f41a964b97de
[INFO]  ---> d22f5a296817
[INFO] Step 7/7 : ENTRYPOINT java $JAVA_OPTS -jar /$DIST_NAME.jar
[INFO]
[INFO]  ---> Running in 9e59e5346032
[INFO] Removing intermediate container 9e59e5346032
[INFO]  ---> c7e0322424c5
[INFO] Successfully built c7e0322424c5
[INFO] Successfully tagged eureka-server:latest
[INFO]
[INFO] Detected build of image with id c7e0322424c5
[INFO] Building jar: /home/tom/Desktop/3/docker2/findservice/target/findservice-1.0-SNAPSHOT-docker-info.jar
[INFO] Successfully built eureka-server:latest
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  31.009 s
[INFO] Finished at: 2021-02-21T02:48:46-08:00

  

 

1
2
3
4
5
6
7
root@ubuntu:/home/tom/Desktop/3/docker2/findservice# docker images
REPOSITORY      TAG            IMAGE ID       CREATED          SIZE
eureka-server   latest         c7e0322424c5   3 minutes ago    128MB
nginx-demo      latest         16e25cfdf65d   3 hours ago      133MB
nginx           latest         35c43ace9216   3 days ago       133MB
hello-world     latest         bf756fb1ae65   13 months ago    13.3kB
openjdk         8-jre-alpine   f7a292bbb70c   21 months ago    84.9MB

  

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
root@ubuntu:/home/tom/Desktop/3/docker2/findservice# docker run -p 8761:8761 eureka-server
2021-02-21 18:52:52.231  INFO 1 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@721e0f4f: startup date [Sun Feb 21 18:52:52 CST 2021]; root of context hierarchy
2021-02-21 18:52:52.552  INFO 1 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2021-02-21 18:52:52.637  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$3482272e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
 
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.7.RELEASE)
 
2021-02-21 18:52:52.976  INFO 1 --- [           main] com.lzj1234.App                          : No active profile set, falling back to default profiles: default
2021-02-21 18:52:53.003  INFO 1 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@490ab905: startup date [Sun Feb 21 18:52:53 CST 2021]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@721e0f4f
2021-02-21 18:52:54.290  INFO 1 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=7bf8c492-0988-3b0a-a46f-c86c9c3e4c65
2021-02-21 18:52:54.314  INFO 1 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2021-02-21 18:52:54.451  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$3482272e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-02-21 18:52:55.083  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2021-02-21 18:52:55.129  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-02-21 18:52:55.130  INFO 1 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.35
2021-02-21 18:52:55.149  INFO 1 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/server:/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64:/usr/lib/jvm/java-1.8-openjdk/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
2021-02-21 18:52:55.248  INFO 1 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-02-21 18:52:55.248  INFO 1 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2245 ms
2021-02-21 18:52:55.469  WARN 1 --- [ost-startStop-1] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2021-02-21 18:52:55.469  INFO 1 --- [ost-startStop-1] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2021-02-21 18:52:55.492  INFO 1 --- [ost-startStop-1] c.netflix.config.DynamicPropertyFactory  : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@7ff65789
2021-02-21 18:52:56.512  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2021-02-21 18:52:56.513  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'webMvcMetricsFilter' to: [/*]
2021-02-21 18:52:56.514  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2021-02-21 18:52:56.514  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2021-02-21 18:52:56.514  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2021-02-21 18:52:56.514  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpTraceFilter' to: [/*]
2021-02-21 18:52:56.514  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'servletContainer' to urls: [/eureka/*]
2021-02-21 18:52:56.514  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Servlet dispatcherServlet mapped to [/]
2021-02-21 18:52:56.628  INFO 1 --- [ost-startStop-1] c.s.j.s.i.a.WebApplicationImpl           : Initiating Jersey application, version 'Jersey: 1.19.1 03/11/2016 02:08 PM'
2021-02-21 18:52:56.728  INFO 1 --- [ost-startStop-1] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON encoding codec LegacyJacksonJson
2021-02-21 18:52:56.730  INFO 1 --- [ost-startStop-1] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON decoding codec LegacyJacksonJson
2021-02-21 18:52:56.940  INFO 1 --- [ost-startStop-1] c.n.d.provider.DiscoveryJerseyProvider   : Using XML encoding codec XStreamXml
2021-02-21 18:52:56.940  INFO 1 --- [ost-startStop-1] c.n.d.provider.DiscoveryJerseyProvider   : Using XML decoding codec XStreamXml
2021-02-21 18:52:57.361  WARN 1 --- [           main] o.s.c.n.a.ArchaiusAutoConfiguration      : No spring.application.name found, defaulting to 'application'
2021-02-21 18:52:57.362  WARN 1 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2021-02-21 18:52:57.363  INFO 1 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2021-02-21 18:52:57.525  INFO 1 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2021-02-21 18:52:57.784  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@490ab905: startup date [Sun Feb 21 18:52:53 CST 2021]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@721e0f4f
2021-02-21 18:52:57.867  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2021-02-21 18:52:57.869  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2021-02-21 18:52:57.876  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/lastn],methods=[GET]}" onto public java.lang.String org.springframework.cloud.netflix.eureka.server.EurekaController.lastn(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.Object>)
2021-02-21 18:52:57.877  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[GET]}" onto public java.lang.String org.springframework.cloud.netflix.eureka.server.EurekaController.status(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.Object>)
2021-02-21 18:52:57.904  INFO 1 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2021-02-21 18:52:57.905  INFO 1 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2021-02-21 18:52:58.408  INFO 1 --- [           main] o.s.ui.freemarker.SpringTemplateLoader   : SpringTemplateLoader for FreeMarker: using resource loader [org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@490ab905: startup date [Sun Feb 21 18:52:53 CST 2021]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@721e0f4f] and template loader path [classpath:/templates/]
2021-02-21 18:52:58.410  INFO 1 --- [           main] o.s.w.s.v.f.FreeMarkerConfigurer         : ClassTemplateLoader for Spring macros added to FreeMarker configuration
2021-02-21 18:52:58.645  INFO 1 --- [           main] o.s.c.n.eureka.InstanceInfoFactory       : Setting initial instance status as: STARTING
2021-02-21 18:52:58.696  INFO 1 --- [           main] com.netflix.discovery.DiscoveryClient    : Initializing Eureka in region us-east-1
2021-02-21 18:52:58.696  INFO 1 --- [           main] com.netflix.discovery.DiscoveryClient    : Client configured to neither register nor query for data.
2021-02-21 18:52:58.712  INFO 1 --- [           main] com.netflix.discovery.DiscoveryClient    : Discovery Client initialized at timestamp 1613904778710 with initial instances count: 0
2021-02-21 18:52:58.780  INFO 1 --- [           main] c.n.eureka.DefaultEurekaServerContext    : Initializing ...
2021-02-21 18:52:58.784  WARN 1 --- [           main] c.n.eureka.cluster.PeerEurekaNodes       : The replica size seems to be empty. Check the route 53 DNS Registry
2021-02-21 18:52:58.809  INFO 1 --- [           main] c.n.e.registry.AbstractInstanceRegistry  : Finished initializing remote region registries. All known remote regions: []
2021-02-21 18:52:58.812  INFO 1 --- [           main] c.n.eureka.DefaultEurekaServerContext    : Initialized
2021-02-21 18:52:58.835  INFO 1 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2021-02-21 18:52:58.853  INFO 1 --- [           main] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/health],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)
2021-02-21 18:52:58.855  INFO 1 --- [           main] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/info],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)
2021-02-21 18:52:58.856  INFO 1 --- [           main] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto protected java.util.Map<java.lang.String, java.util.Map<java.lang.String, org.springframework.boot.actuate.endpoint.web.Link>> org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping.links(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2021-02-21 18:52:58.914  INFO 1 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2021-02-21 18:52:58.923  INFO 1 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'environmentManager' has been autodetected for JMX exposure
2021-02-21 18:52:58.925  INFO 1 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'refreshScope' has been autodetected for JMX exposure
2021-02-21 18:52:58.926  INFO 1 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'configurationPropertiesRebinder' has been autodetected for JMX exposure
2021-02-21 18:52:58.929  INFO 1 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located managed bean 'environmentManager': registering with JMX server as MBean [org.springframework.cloud.context.environment:name=environmentManager,type=EnvironmentManager]
2021-02-21 18:52:58.942  INFO 1 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located managed bean 'refreshScope': registering with JMX server as MBean [org.springframework.cloud.context.scope.refresh:name=refreshScope,type=RefreshScope]
2021-02-21 18:52:58.954  INFO 1 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located managed bean 'configurationPropertiesRebinder': registering with JMX server as MBean [org.springframework.cloud.context.properties:name=configurationPropertiesRebinder,context=490ab905,type=ConfigurationPropertiesRebinder]
2021-02-21 18:52:58.967  INFO 1 --- [           main] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 0
2021-02-21 18:52:58.973  INFO 1 --- [           main] o.s.c.n.e.s.EurekaServiceRegistry        : Registering application UNKNOWN with eureka with status UP
2021-02-21 18:52:58.983  INFO 1 --- [      Thread-13] o.s.c.n.e.server.EurekaServerBootstrap   : Setting the eureka configuration..
2021-02-21 18:52:58.984  INFO 1 --- [      Thread-13] o.s.c.n.e.server.EurekaServerBootstrap   : Eureka data center value eureka.datacenter is not set, defaulting to default
2021-02-21 18:52:58.985  INFO 1 --- [      Thread-13] o.s.c.n.e.server.EurekaServerBootstrap   : Eureka environment value eureka.environment is not set, defaulting to test
2021-02-21 18:52:59.029  INFO 1 --- [      Thread-13] o.s.c.n.e.server.EurekaServerBootstrap   : isAws returned false
2021-02-21 18:52:59.030  INFO 1 --- [      Thread-13] o.s.c.n.e.server.EurekaServerBootstrap   : Initialized server context
2021-02-21 18:52:59.031  INFO 1 --- [      Thread-13] c.n.e.r.PeerAwareInstanceRegistryImpl    : Got 1 instances from neighboring DS node
2021-02-21 18:52:59.031  INFO 1 --- [      Thread-13] c.n.e.r.PeerAwareInstanceRegistryImpl    : Renew threshold is: 1
2021-02-21 18:52:59.031  INFO 1 --- [      Thread-13] c.n.e.r.PeerAwareInstanceRegistryImpl    : Changing status to UP
2021-02-21 18:52:59.071  INFO 1 --- [      Thread-13] e.s.EurekaServerInitializerConfiguration : Started Eureka Server
2021-02-21 18:52:59.076  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2021-02-21 18:52:59.078  INFO 1 --- [           main] .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 8080
2021-02-21 18:52:59.081  INFO 1 --- [           main] com.lzj1234.App                          : Started App in 7.492 seconds (JVM running for 8.149)