在Bitbucket管道中运行Docker
我需要使用- exit-code-from
运行Docker-Compose。我当地的Docker-compose二进制二进制命令行,正常工作。
+ docker-compose -f file1.yml -f file2.yml up zookeeper-secure kafka-secure schema-registry-secure app integration-tests --exit-code-from integration-tests
但是,我需要在Bitbucket管道中运行此操作。为了实现这一点,我使用PIP安装程序安装了Docker-Compose
pip install docker-compose
,它为我提供了1.29.2版
+ docker-compose version
docker-compose version 1.29.2, build unknown
docker-py version: 5.0.3
CPython version: 3.7.12
OpenSSL version: OpenSSL 1.1.1d 10 Sep 2019
,此版本可能不荣幸-Exit-code-from,因此
No such service: --exit-code-from
在查看Docker Docs时出现了错误,我发现Compose现在可以在Docker中提供。 CLI本身(尽管从哪个版本开始并不清楚),但是我的Bitbucket管道也不认识到这一点。
+ docker compose help
docker: 'compose' is not a docker command.
See 'docker --help'
这是我的Bitbucket管道中的Docker版本输出,
+ docker version
Client:
Version: 20.10.15
API version: 1.41
Go version: go1.17.9
Git commit: fd82621
Built: Thu May 5 13:10:20 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.15
API version: 1.41 (minimum version 1.12)
Go version: go1.17.9
Git commit: 4433bf6
Built: Thu May 5 13:10:29 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.6.4
GitCommit: 212e8b6fa2f44b9c21b2798135fc6fb7c53efc16
runc:
Version: 1.1.1
GitCommit: v1.1.1-0-g52de29d7
docker-init:
Version: 0.19.0
GitCommit: de40ad0
任何帮助都将不胜感激!
I need to run docker-compose with --exit-code-from
. My local docker-compose binary accepts this command line and works just fine.
+ docker-compose -f file1.yml -f file2.yml up zookeeper-secure kafka-secure schema-registry-secure app integration-tests --exit-code-from integration-tests
However, I need to run this in a bitbucket pipeline. To achieve that I installed docker-compose using pip installer
pip install docker-compose
Which gives me version 1.29.2
+ docker-compose version
docker-compose version 1.29.2, build unknown
docker-py version: 5.0.3
CPython version: 3.7.12
OpenSSL version: OpenSSL 1.1.1d 10 Sep 2019
And this version probably does not honour --exit-code-from and hence errors out
No such service: --exit-code-from
While looking into docker docs, i found compose is now available in docker cli itself (though not very clear from which version onwards), but my bitbucket pipeline does not recognise that too.
+ docker compose help
docker: 'compose' is not a docker command.
See 'docker --help'
Here is the docker version output inside my bitbucket pipeline
+ docker version
Client:
Version: 20.10.15
API version: 1.41
Go version: go1.17.9
Git commit: fd82621
Built: Thu May 5 13:10:20 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.15
API version: 1.41 (minimum version 1.12)
Go version: go1.17.9
Git commit: 4433bf6
Built: Thu May 5 13:10:29 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.6.4
GitCommit: 212e8b6fa2f44b9c21b2798135fc6fb7c53efc16
runc:
Version: 1.1.1
GitCommit: v1.1.1-0-g52de29d7
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Any help will be much appreciated !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于
- 2017年4月推出了
选项,因此 v1.12.0 ,我认为Docker-Compose V1 Cli Parser比您在工作站中可能拥有的Docker-Compose V2要挑剔得多。通过
告知没有这样的服务: - exit-code-from
错误消息,只需在up up
subcmmand之后移动该选项,但在服务列表开始之前:非常相关:非常相关: https://stackoverflow.com/59840305/11715259
否则v2在Bitbucket管道中”,这是一个完全不同的主题:
Since the
--exit-code-from
option was introduced in April 2017, v1.12.0, I think the docker-compose v1 CLI parser is being much more picky than the docker-compose v2 you probably have in your workstation.Telling by the
No such service: --exit-code-from
error message, simply move the option after theup
subcommand but before the service list begins:Very much related: https://stackoverflow.com/a/59840305/11715259
Otherwise, this question is about "how to use docker-compose v2 in Bitbucket Pipelines", which is a totally different topic: https://stackoverflow.com/a/73069569/11715259