如何使用docker

66次阅读
没有评论

共计 1083 个字符,预计需要花费 3 分钟才能阅读完成。

这篇文章主要介绍了如何使用 docker-maven-plugin 插件设置 Docker 的 buildArgs,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让丸趣 TV 小编带着大家一起了解一下。

docker-maven-plugin 是 spotify 出品的一款针对 spring boot 项目的 docker 插件,可将 spring boot 项目打包到 docker 镜像中。

如果在编译 docker 镜像时需要设置 build arg,只需要在 maven 的配置文件 pom.xml 中,configuration 下增加 buildArgs。标签的 key 和值对应 build arg 的 key 和值,如下所示,docker 镜像编译过程中,会有一个 build arg 名为 ARG_TIME_ZONE,而其值则为 OS 的环境变量 TIME_ZONE。

  build 
  plugins 
  plugin 
  groupId com.spotify /groupId 
  artifactId docker-maven-plugin /artifactId 
  version 0.4.13 /version 
  executions 
  execution 
  phase package /phase 
  goals 
  goal build /goal 
  /goals 
  /execution 
  /executions 
  configuration 
  imageName ${docker.registry.name}/${project.artifactId}:latest /imageName 
  dockerDirectory src/main/docker /dockerDirectory 
  buildArgs 
  ARG_TIME_ZONE ${env.TIME_ZONE} /ARG_TIME_ZONE 
  /buildArgs 
  resources 
  resource 
  targetPath / /targetPath 
  directory ${project.build.directory} /directory 
  include ${project.build.finalName}.jar /include 
  /resource 
  /resources 
  /configuration 
  /plugin 
  /plugins 
  /build

感谢你能够认真阅读完这篇文章,希望丸趣 TV 小编分享的“如何使用 docker-maven-plugin 插件设置 Docker 的 buildArgs”这篇文章对大家有帮助,同时也希望大家多多支持丸趣 TV,关注丸趣 TV 行业资讯频道,更多相关知识等着你来学习!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-08-25发表,共计1083字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)