bil*_*ohi 35 git docker docker-compose
Docker-compose允许您使用preëxisting泊坞窗图像或从源构建.对于构建选项,官方参考需要
包含Dockerfile的目录的路径,或者是git存储库的url.
我想利用后一种情况,这样我就不必在项目中创建一个git子模块,或者在Docker Hub上注册一个新的存储库.不幸的是,没有关于如何格式化url的示例,我尝试的每个表单都被误认为是相对文件路径.
例如
---
letsencrypt:
build: https://github.com/letsencrypt/letsencrypt.git
...
Run Code Online (Sandbox Code Playgroud)
失败并出现错误:
错误:构建路径/{MY_CURRENT_PATH}/https:/github.com/letsencrypt/letsencrypt.git要么不存在,要么无法访问.
我尝试过的其他表格没有任何运气了:
And*_*inn 23
你在运行1.5.2版吗?看起来这最近实际上是在https://github.com/docker/compose/pull/2430中添加的.尝试升级.
例:
---
version: '2'
services:
redis:
image: "redis:3.2.3"
hostname: redis
redis-commander:
build: https://github.com/joeferner/redis-commander.git
command: --redis-host redis
links:
- "redis:redis"
ports:
- 8081
Run Code Online (Sandbox Code Playgroud)
经测试:
$ docker-compose -v
docker-compose version 1.11.2, build dfed245
Run Code Online (Sandbox Code Playgroud)
该文件tests/unit/config/config_test.py
显示:
def test_valid_url_in_build_path(self):
valid_urls = [
'git://github.com/docker/docker',
'git@github.com:docker/docker.git',
'git@bitbucket.org:atlassianlabs/atlassian-docker.git',
'https://github.com/docker/docker.git',
'http://github.com/docker/docker.git',
'github.com/docker/docker.git',
]
Run Code Online (Sandbox Code Playgroud)
这证实了compose/config/config.py#L79-L85
:
DOCKER_VALID_URL_PREFIXES = (
'http://',
'https://',
'git://',
'github.com/',
'git@',
)
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
18310 次 |
最近记录: |