加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Docker:如何从Github存储库上的非主分支构建映像

发布时间:2020-12-16 03:29:56 所属栏目:安全 来源:网络整理
导读:是否可以从Github存储库上的非主分支构建映像? 例如,我有一个存储库//github.com/myAccount/docker-myImage,它有一个分支开发,我想用于我的图像.不幸的是,以下命令似乎只允许从主分支构建: docker build -t myAccount/myImage git://github.com/myAccount/

是否可以从Github存储库上的非主分支构建映像?

例如,我有一个存储库//github.com/myAccount/docker-myImage,它有一个分支开发,我想用于我的图像.不幸的是,以下命令似乎只允许从主分支构建:

docker build -t myAccount/myImage git://github.com/myAccount/docker-myImage

以下是man docker build的相关文档:

Building an image using a URL
       This will clone the specified Github repository from the URL and use it as context.
       The Dockerfile at the root of the repository is used as Dockerfile. This only works
       if the Github repository is a dedicated repository.

              docker build github.com/scollier/Fedora-Dockerfiles/tree/master/apache

              Note: You can set an arbitrary Git repository via the git:// schema.

也许有一个替代方案,比如docker build -t myAccount / myImage git://github.com/myAccount/docker-myImage:development?

最佳答案
docker build -t myAccount / myImage https://github.com/myAccount/docker-myImage.git#development

有关更多选项,请参见docker build command reference.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读