On docker deployment project in spring boot server

IDE: idea

Tools: docker

spring boot:2.0.1

========================================

Simply record what processes, for reference:

The first step: Start a spring boot project [integrated boot of examples spring jpa + mybatis: https://github.com/AngelSXD/swapping ]

Step Two: The project is packaged as a jar package

After the install success

To find the target directory under the project root directory, which is packed inside the jar jar package can be deployed

 

The third step: preparation and other server environments, such as mysql database, docker

  Go to the server, install docker [step on centOS7: https://www.cnblogs.com/sxdcgaq8080/p/9178918.html

  If you want to install mysql on the server, as follows: [ https://www.cnblogs.com/sxdcgaq8080/p/9199406.html ]

  [Of course, you pack a jar, the address database configuration file needs to be connected to the actual address of your mysql, database connections are not otherwise]

 

 

Step four: jar package ready on the server file storage directory and Dockerfile

  Go to the server, create your jar package uploaded to the server to put the directory, for example: [create a directory on a linux command to check yourself! ! ]

  I want to jar package is about to be placed under this directory:

 

And create in this catalog Dockerfile file and paste the following passage in Dockerfile file using [vi command to create and fill the complete file contents of the file]

FROM java:8
VOLUME /temp
ADD swapping.jar swapping.jar
RUN bash -c 'touch /swapping.jar'
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","-Xmx1024m","-Xms1024m","/swapping.jar"]

For the interpretation of the file contents: [Dockerfile command interpreter: http://www.docker.org.cn/dockerppt/114.html ]

FROM java: 8 

specifies the basis to build service mirror in spring boot image is java, version 8; if no local java: mirror 8, will be downloaded from dockerHub. Generally the first download, then would not download.
VOLUME / the TEMP 

VOLUME pointing within the container / tmp directory, since Spring Boot using the built-in Tomcat container, Tomcat defaults to / tmp as the working directory. The effect of this command is: create a temporary file in / var / lib / docker host directory and link it to / container tmp directory 

VOLUME command specifies only mount point, that is to say in here, only directory can be specified in the vessel, not corresponding to the specified directory on the host, that is automatically generated on the host to mount the directory specified in the container / tmp directory! ! ! 
If you want to specify the directory to be the host of the mount command can only be run in the specified directory in the specified directory of the host to mount -v parameter container
ADD swapping.jar swapping.jar 

is actually ADD [rz] [file upload up to be copied to the file docker container is about to be built in]
RUN bash -c 'touch /swapping.jar' 

actually perform the copy operation command
EntryPoint [ "Java", "- Djava.security.egd = File: / dev /./ urandom", "- JAR", "- Xmx1024m", "- Xms1024m", "/ swapping.jar" ] 

EntryPoint startup configuration container after executing the command, and can not be covered docker run parameters provided. 

File = -Djava.security.egd: / dev /./ urandom 
add java.security.egd system attributes point to / dev / urandom, a random number and entropy pool policy on the JVM 
reference address: [HTTPS: // blog.csdn .net / lanmo555 / article / details / 51909021 ]

Step Five: Upload the jar package

Jar package name to modify: modify the file name [consistent with the need to configure Dockerfile file] swapping.jar

 

  Use the command rz

 

note,

#Dockerfile and jar package in the same directory

 

 

 

Step Six: jar package need to enter the directory, create a mirror using the jar package

  Command is as follows: [Note] a little oh

docker build -t swapping .

 

 

 

 Step Seven: Run the mirror, start docker container

  The easiest run the command

docker run --name swapping -itd --net=host  swapping 

Note that spring boot command to start the project area [on the issue of time zones deal with the problem, need to refer to: https://www.cnblogs.com/sxdcgaq8080/p/10057385.html ]

  Note that spring to start the application boot configuration file and start the development project profiles production profile [ https://www.cnblogs.com/sxdcgaq8080/p/10481974.html ]

docker run --name swapping -itd --net=host -v /etc/localtime:/etc/localtime:ro  -v /etc/timezone:/etc/timezone:ro  swapping

After a successful start: View the situation to start a container

docker logs -f swapping

Quit using the Log Viewer

Ctrl+Z

View start running log is as follows:

root@wj:/soft/java/dockerJar/swapping# docker logs -f swapping

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.1.RELEASE)

2018-12-03 10:25:38.055  INFO 1 --- [           main] com.sxd.swapping.SwappingApplication     : Starting SwappingApplication v0.0.1-SNAPSHOT on wj.luna.base with PID 1 (/swapping.jar started by root in /)
2018-12-03 10:25:38.060  INFO 1 --- [           main] com.sxd.swapping.SwappingApplication     : No active profile set, falling back to default profiles: default
2018-12-03 10:25:38.257  INFO 1 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@1ef7fe8e: startup date [Mon Dec 03 10:25:38 CST 2018]; root of context hierarchy
2018-12-03 10:25:41.232  INFO 1 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2018-12-03 10:25:41.429  INFO 1 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2018-12-03 10:25:41.452  INFO 1 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.sxd.swapping.dao.jpa.GoodsStockDao.
2018-12-03 10:25:41.455  INFO 1 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.sxd.swapping.dao.jpa.HuaYangAreaDao.
2018-12-03 10:25:42.341  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$3b883049] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-12-03 10:25:43.196  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 9666 (http)
2018-12-03 10:25:43.243  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2018-12-03 10:25:43.243  INFO 1 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.29
2018-12-03 10:25:43.270  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/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib]
2018-12-03 10:25:43.528  INFO 1 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2018-12-03 10:25:43.529  INFO 1 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 5277 ms
2018-12-03 10:25:44.010  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Servlet statViewServlet mapped to [/druid/*]
2018-12-03 10:25:44.013  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Servlet dispatcherServlet mapped to [/]
2018-12-03 10:25:44.020  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-12-03 10:25:44.020  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-12-03 10:25:44.021  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-12-03 10:25:44.021  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2018-12-03 10:25:44.021  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'webStatFilter' to urls: [/*]
2018-12-03 10:25:44.616  INFO 1 --- [           main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2018-12-03 10:25:44.664  INFO 1 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
    name: default
    ...]
2018-12-03 10:25:44.874  INFO 1 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {5.2.16.Final}
2018-12-03 10:25:44.878  INFO 1 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2018-12-03 10:25:44.982  INFO 1 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
DEBUG - {conn-10001} connected
DEBUG - {conn-10002} connected
DEBUG - {conn-10003} connected
DEBUG - {conn-10004} connected
DEBUG - {conn-10005} connected
2018-12-03 10:25:45.859  INFO 1 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} inited
DEBUG - {conn-10005} pool-connect
2018-12-03 10:25:45.890  INFO 1 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL55Dialect
DEBUG - {conn-10005} pool-recycle
DEBUG - {conn-10005} pool-connect
DEBUG - {conn-10005} pool-recycle
2018-12-03 10:25:46.948  INFO 1 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2018-12-03 10:25:47.626  INFO 1 --- [           main] o.h.h.i.QueryTranslatorFactoryInitiator  : HHH000397: Using ASTQueryTranslatorFactory
2018-12-03 10:25:50.730  WARN 1 --- [           main] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2018-12-03 10:25:50.872  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/huayang/pages],methods=[GET]}" onto public com.sxd.swapping.base.PageResponse<com.sxd.swapping.domain.HuaYangArea> com.sxd.swapping.controller.HuaYangApiWithJPA.pages(com.sxd.swapping.domain.HuaYangArea)
2018-12-03 10:25:50.874  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/huayang],methods=[POST]}" onto public com.sxd.swapping.base.UniVerResponse<com.sxd.swapping.domain.HuaYangArea> com.sxd.swapping.controller.HuaYangApiWithJPA.huayang(com.sxd.swapping.domain.HuaYangArea)
2018-12-03 10:25:50.874  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/huayang/huayangs],methods=[GET]}" onto public com.sxd.swapping.base.UniVerResponse<java.util.List<com.sxd.swapping.domain.HuaYangArea>> com.sxd.swapping.controller.HuaYangApiWithJPA.huayangs(java.lang.String)
2018-12-03 10:25:50.875  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/huayang/updates],methods=[POST]}" onto public com.sxd.swapping.base.UniVerResponse<java.util.List<com.sxd.swapping.domain.HuaYangArea>> com.sxd.swapping.controller.HuaYangApiWithJPA.updates(com.sxd.swapping.base.BatchBean)
2018-12-03 10:25:50.875  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/huayang/update],methods=[PUT]}" onto public com.sxd.swapping.base.UniVerResponse<com.sxd.swapping.domain.HuaYangArea> com.sxd.swapping.controller.HuaYangApiWithJPA.update(com.sxd.swapping.domain.HuaYangArea)
2018-12-03 10:25:50.895  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/huayangMybatis/oneHuaYang],methods=[GET]}" onto public com.sxd.swapping.base.UniVerResponse<com.sxd.swapping.domain.HuaYangArea> com.sxd.swapping.controller.HuaYangApiWithMyBatis.findOne(java.lang.String)
2018-12-03 10:25:50.900  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/huayangMybatis/findMap],methods=[GET]}" onto public com.sxd.swapping.base.UniVerResponse<java.util.Map<java.lang.String, java.lang.String>> com.sxd.swapping.controller.HuaYangApiWithMyBatis.findMap(com.sxd.swapping.domain.HuaYangArea)
2018-12-03 10:25:50.900  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/huayangMybatis/findBy3],methods=[GET]}" onto public com.sxd.swapping.base.UniVerResponse<java.util.List<com.sxd.swapping.base.HuaYangModelBean>> com.sxd.swapping.controller.HuaYangApiWithMyBatis.findByNameAndPersonAndCreateDate(com.sxd.swapping.domain.HuaYangArea)
2018-12-03 10:25:50.901  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/huayangMybatis/findBy3Page],methods=[GET]}" onto public com.sxd.swapping.base.PageResponse<com.sxd.swapping.base.HuaYangModelBean> com.sxd.swapping.controller.HuaYangApiWithMyBatis.findByNameAndPersonAndCreateDatePage(com.sxd.swapping.domain.HuaYangArea)
2018-12-03 10:25:50.902  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/huayangMybatis/findByNameLike],methods=[GET]}" onto public com.sxd.swapping.base.UniVerResponse<java.util.List<com.sxd.swapping.domain.HuaYangArea>> com.sxd.swapping.controller.HuaYangApiWithMyBatis.findAll1(java.lang.String)
2018-12-03 10:25:50.904  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/huayangMybatis/findByNameLike2],methods=[GET]}" onto public com.sxd.swapping.base.UniVerResponse<java.util.List<com.sxd.swapping.domain.HuaYangArea>> com.sxd.swapping.controller.HuaYangApiWithMyBatis.findAll2(java.lang.String)
2018-12-03 10:25:50.912  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/huayangMybatis/oneHuaYang],methods=[DELETE]}" onto public com.sxd.swapping.base.UniVerResponse<java.lang.String> com.sxd.swapping.controller.HuaYangApiWithMyBatis.deleteOne(java.lang.Long)
2018-12-03 10:25:50.913  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/huayangMybatis/update],methods=[PUT]}" onto public com.sxd.swapping.base.UniVerResponse<com.sxd.swapping.domain.HuaYangArea> com.sxd.swapping.controller.HuaYangApiWithMyBatis.update(com.sxd.swapping.domain.HuaYangArea)
2018-12-03 10:25:50.913  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/huayangMybatis/insert],methods=[POST]}" onto public com.sxd.swapping.base.UniVerResponse<com.sxd.swapping.domain.HuaYangArea> com.sxd.swapping.controller.HuaYangApiWithMyBatis.insert(com.sxd.swapping.domain.HuaYangArea)
2018-12-03 10:25:50.914  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/goods/stock/concurrentStock],methods=[POST]}" onto public com.sxd.swapping.base.UniVerResponse<java.util.Map<java.lang.Integer, java.lang.String>> com.sxd.swapping.controller.GoodsStockController.concurrentStock(com.sxd.swapping.domain.GoodsStock)
2018-12-03 10:25:50.917  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/goods/stock/insert],methods=[POST]}" onto public com.sxd.swapping.base.UniVerResponse<com.sxd.swapping.domain.GoodsStock> com.sxd.swapping.controller.GoodsStockController.insert(com.sxd.swapping.domain.GoodsStock)
2018-12-03 10:25:50.919  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/createCode/getCode]}" onto public com.sxd.swapping.base.UniVerResponse<java.lang.String> com.sxd.swapping.controller.CreateCodeController.createCode()
2018-12-03 10:25:50.927  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/swagger-resources/configuration/ui]}" onto public org.springframework.http.ResponseEntity<springfox.documentation.swagger.web.UiConfiguration> springfox.documentation.swagger.web.ApiResourceController.uiConfiguration()
2018-12-03 10:25:50.934  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/swagger-resources/configuration/security]}" onto public org.springframework.http.ResponseEntity<springfox.documentation.swagger.web.SecurityConfiguration> springfox.documentation.swagger.web.ApiResourceController.securityConfiguration()
2018-12-03 10:25:50.935  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/swagger-resources]}" onto public org.springframework.http.ResponseEntity<java.util.List<springfox.documentation.swagger.web.SwaggerResource>> springfox.documentation.swagger.web.ApiResourceController.swaggerResources()
2018-12-03 10:25:50.941  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)
2018-12-03 10:25:50.942  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)
2018-12-03 10:25:51.332  INFO 1 --- [           main] pertySourcedRequestMappingHandlerMapping : Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)]
2018-12-03 10:25:51.590  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]
2018-12-03 10:25:52.093  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@1ef7fe8e: startup date [Mon Dec 03 10:25:38 CST 2018]; root of context hierarchy
2018-12-03 10:25:52.297  INFO 1 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-12-03 10:25:52.298  INFO 1 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-12-03 10:25:52.321  INFO 1 --- [           main] .m.m.a.ExceptionHandlerExceptionResolver : Detected @ExceptionHandler methods in myControllerAdvice
2018-12-03 10:25:53.431  INFO 1 --- [           main] o.s.ui.freemarker.SpringTemplateLoader   : SpringTemplateLoader for FreeMarker: using resource loader [org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@1ef7fe8e: startup date [Mon Dec 03 10:25:38 CST 2018]; root of context hierarchy] and template loader path [classpath:/templates/]
2018-12-03 10:25:53.432  INFO 1 --- [           main] o.s.w.s.v.f.FreeMarkerConfigurer         : ClassTemplateLoader for Spring macros added to FreeMarker configuration
2018-12-03 10:25:53.485  WARN 1 --- [           main] o.s.b.a.f.FreeMarkerAutoConfiguration    : Cannot find template location(s): [classpath:/templates/] (please add some templates, check your FreeMarker configuration, or set spring.freemarker.checkTemplateLocation=false)
2018-12-03 10:25:53.998  INFO 1 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2018-12-03 10:25:54.001  INFO 1 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'dataSource' has been autodetected for JMX exposure
2018-12-03 10:25:54.018  INFO 1 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located MBean 'dataSource': registering with JMX server as MBean [com.alibaba.druid.pool:name=dataSource,type=DruidDataSource]
2018-12-03 10:25:54.031  INFO 1 --- [           main] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 2147483647
2018-12-03 10:25:54.031  INFO 1 --- [           main] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
2018-12-03 10:25:54.070  INFO 1 --- [           main] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s)
2018-12-03 10:25:54.164  INFO 1 --- [           main] s.d.s.w.s.ApiListingReferenceScanner     : Scanning for api listing references
2018-12-03 10:25:54.802  INFO 1 --- [           main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: insertUsingPOST_1
2018-12-03 10:25:54.806  INFO 1 --- [           main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: updateUsingPUT_1
2018-12-03 10:25:54.944  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 9666 (http) with context path ''
2018-12-03 10:25:54.969  INFO 1 --- [           main] com.sxd.swapping.SwappingApplication     : Started SwappingApplication in 17.782 seconds (JVM running for 18.811)

You can start to see success.

 

 

Step eight: Access Service to see if normal

Interface to return to normal

 

Normal database storage

 

Well, the service is deployed to pull! ! ! ! !

 

 

OK, if you want to restart the spring boot service, you can use the command

docker restart swapping

ok now, if the code is updated, you want to stop the service, remove springboot service, redeployment

Respectively, to perform the steps of

Out of service

docker stop swapping

Remove the container

docker rm -f swapping

Remove the jar package

rm -f swapping.jar

[Repackaging idea connection address in operation, note profile configuration]

[Note Dockerfile file and specify a jar file name, needs to be consistent with the jar package file name upload]

Upload jar package

rz

And then re-create the mirror

docker build -t swapping .

Start Service

docker run --name swapping -itd --net=host -v /etc/localtime:/etc/localtime:ro  -v /etc/timezone:/etc/timezone:ro  swapping

To complete the redeployment! ! !

 

Of course, before you build the image file still exists, although it does not affect the use of your project, but your presence will occupy space in your mirror server

So you can use the command to check what the current mirror

docker images

You can use the command, do not delete the image file

docker rmi 9d3ee8a877d3

 

Guess you like

Origin www.cnblogs.com/shanheyongmu/p/11805104.html