以Github为上下文,构建Docker image详解

来源:互联网 发布:otf字体怎么安装到mac 编辑:程序博客网 时间:2024/04/28 06:41

以远程Github为上下文,Docker构建image的示例如下:

  • docker build -t myAccount/myImage https://github.com/champagne/docker-myImage.git
默认以refs/heads/master分支
  • docker build -t myAccount/myImage https://github.com/champagne/docker-myImage.git#mybranch
refs/heads/mybranch分支
  • docker build -t myAccount/myImage https://github.com/champagne/docker-myImage.git#mytag
refs/tags/mytag
  • docker build -t myAccount/myImage https://github.com/champagne/docker-myImage.git#commit_SHA1
一次commit id
  • docker build -t myAccount/myImage https://github.com/champagne/docker-myImage.git#:mydir
  • docker build -t myAccount/myImage https://github.com/champagne/docker-myImage.git#master:mydir
refs/heads/master分支下的mydir目录
  • docker build -t myAccount/myImage https://github.com/champagne/docker-myImage.git#mybranch:mydir
refs/heads/mybranch分支下的mydir目录
  • docker build -t myAccount/myImage https://github.com/champagne/docker-myImage.git#mytag:mydir
refs/tags/mytag下的mydir目录
  • docker build -t myAccount/myImage https://github.com/champagne/docker-myImage.git#commit_SHA1:mydir
一次commit id下的mydir目录


参考链接:

https://docs.docker.com/engine/reference/commandline/build/

1 0
原创粉丝点击