docker development specification

偏执的太偏执、 2022-12-25 01:49 186阅读 0赞

Using Docker to simplify development (optional)

前提:把spring-boot-starter-tomcat依赖的provided scope注释掉(如果不注掉,通过java命令运行项目时会因缺少jar包无法成功启动)

Building and running a Docker image of your application

To build a Docker image of your application without Docker and push it directly into your Docker registry, run:

  1. mvn compile jib:build -Djib.to.image=myregistry/myimage:latest -Djib.to.auth.username=$USERNAME -Djib.to.auth.password=$PASSWORD

To build a Docker image of your application using Jib connecting to the local Docker daemon:

  1. mvn compile jib:dockerBuild

To run this image, use the following docker run command:

  1. docker run -itd -p 8080:8080 visualize

Using Docker Compose to simplify development (optional)

前提:已生成image

To run this image, use the Docker Compose configuration located in the src/main/docker folder of your application:

  1. docker-compose -f src/main/docker/app.yml up -d

This command will start up your application and the services it relies on(database, redis…).

Build an image tarball(run image in production)

You can build and save your image to disk as a tarball with:

  1. mvn compile jib:buildTar

This builds and saves your image to target/jib-image.tar, which you can load into docker with:

  1. docker load --input target/jib-image.tar

发表评论

表情:
评论列表 (有 0 条评论,186人围观)

还没有评论,来说两句吧...

相关阅读

    相关 错误specificity:nan

    最近用神经网络做三分类,出现了这个问题,有的时候有有的时候没有。 缘来是因为我做三分类用了二分类代码的评价指标。 我把二分类和三分类的评价指标python粘在这里,需要

    相关 jpa specification条件查询

    1. 1. [spring][] data jpa 通过创建方法名来做查询,只能做简单的查询,那如果我们要做复杂一些的查询呢,多条件分页怎么办,这里,spring data