根据文档,git url可以传递给构建命令:
但是如果git url需要成为分支名称会发生什么?换句话说,我该怎么做呢:
git clone -b my-firefox-branch git@github.com:freack/docker-firefox.git
以git://
(或https://
)开始您的 URL,并简单地在 之后附加分支名称#
。
我只是分叉了 OP 的 repo 并创建了一个分支来确认它的工作原理(docker 版本 1.11.1):
root@box:~# docker build git://github.com/michielbdejong/docker-firefox#michielbdejong-patch-1
Sending build context to Docker daemon 52.22 kB
Step 1 : FROM ubuntu:12.04
12.04: Pulling from library/ubuntu
4edf76921243: Downloading
[==========> ] 9.633 MB/44.3 MB
^Croot@box:~#
Run Code Online (Sandbox Code Playgroud)
有关完整文档,请参阅https://docs.docker.com/engine/reference/commandline/build/。
到目前为止,不,不能。
这是我得到的:
$ docker build git@github.com:shawnzhu/docker-ruby.git#branch1
2014/12/04 08:19:04 Error trying to use git: exit status 128 (Cloning into '/var/folders/9q/bthxttfj2lq7jtz0b_f938gr0000gn/T/docker-build-git859493111'...
fatal: remote error:
is not a valid repository name
Email support@github.com for help
)
Run Code Online (Sandbox Code Playgroud)
如果你看一下这行docker CLI 代码,它只会--depth=1
在使用docker build <git-repo-url>
.
然而,这可能是对 docker 的一个有趣的改进(如果人们想要的话),因为#<branch-name>
和#<commit>
是 github URL 的流行语法,被许多工具(如npm和 Bower)采用。
归档时间: |
|
查看次数: |
3541 次 |
最近记录: |