【发布时间】:2021-07-11 12:44:47
【问题描述】:
我想在 Bitbucket 管道中运行一个 docker 容器。但是我无法执行任何命令,因为它声称 docker 守护程序没有运行。但是,我没有找到任何方法来启动它。
INFO Running command 'which docker' in '/opt/atlassian/pipelines/agent/build'
INFO STDOUT b'/usr/bin/docker\n'
INFO STDERR b''
INFO Running command 'docker --version' in '/opt/atlassian/pipelines/agent/build'
INFO STDOUT b'Docker version 19.03.15, build 99e3ed8\n'
INFO STDERR b''
INFO Running command 'systemctl start docker' in '/opt/atlassian/pipelines/agent/build'
INFO STDOUT b''
INFO STDERR b'/bin/sh: 1: systemctl: not found\n'
INFO Running command 'sudo systemctl start docker' in '/opt/atlassian/pipelines/agent/build'
INFO STDOUT b''
INFO STDERR b'/bin/sh: 1: sudo: not found\n'
INFO Trying to remove old Docker container...
INFO Running command 'docker container rm test_container' in '/opt/atlassian/pipelines/agent/build'
INFO STDOUT b''
INFO STDERR b'Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?\n'
我已经读过,以某种方式将外部守护程序通过管道传输到容器中是很常见的,但我找不到任何方法来实现这一点。
那么谁能告诉我这应该如何工作?
顺便说一句,我正在使用“subprocess.Popen(...)”在 python 进程中执行命令。
这是bitbucket-pipelines.yml中对应的步骤:
- step: &test-docker
name: Build the docker container and run the tests against it
script:
- pip install tox
- docker info
- tox -e test-docker
services:
- docker
【问题讨论】:
标签: docker bitbucket-pipelines