[英]docker compose in bitbucket - Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
I want to deploy container group to Azure Container Instances from bitbucket pipelines.我想从 bitbucket 管道将容器组部署到 Azure 容器实例。 I have following
bitbucket-pipelines.yml
file:我有以下
bitbucket-pipelines.yml
文件:
image: ubuntu:20.04
clone:
depth: 5
options:
max-time: 15
pipelines:
branches:
master:
- step:
name: Deploy to aci
deployment: test
script:
- apt-get update
- apt-get install curl -y
- curl -L https://raw.githubusercontent.com/docker/compose-cli/main/scripts/install/install_linux.sh | sh
- curl -sSL https://github.com/docker/compose-cli/releases/download/v2.0.0-beta.3/docker-compose-linux-amd64 -o docker-compose
- chmod +x docker-compose
- mkdir -p ~/.docker/cli-plugins
- mv docker-compose ~/.docker/cli-plugins/docker-compose
- docker login azure --client-id $CLIENTID --tenant-id $TENANTID --client-secret $SECRET
- docker login myregistry.azurecr.io -u $USERNAME -p $PASS
- docker context create aci myContext --subscription-id "00000000-0000-0000-0000-000000000000" --resource-group "myResouceGroup" --location "westeurope"
- docker --context myContext compose up
services:
- docker
I am getting following error on docker --context myContext compose up
command:我在
docker --context myContext compose up
命令上遇到以下错误:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
All other docker command seems to be working so it's seems to be problem with docker-compose cli that it doesn't find the deamon running.所有其他 docker 命令似乎都在工作,所以 docker-compose cli 似乎有问题,它没有发现守护进程正在运行。
I tried adding export DOCKER_HOST="tcp://0.0.0.0:2375"
before docker compose up
but it didn't help.我尝试在
export DOCKER_HOST="tcp://0.0.0.0:2375"
docker compose up
之前添加export DOCKER_HOST="tcp://0.0.0.0:2375"
但它没有帮助。
Is there something I am missing?有什么我想念的吗?
UPDATE 1:更新1:
If I update last command from:如果我从以下位置更新最后一个命令:
- docker --context myContext compose up
To:至:
- docker context use myContext
- docker compose up
I am getting different error: failed to dial gRPC: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing unable to upgrade to h2c, received 403"
我收到不同的错误:
failed to dial gRPC: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing unable to upgrade to h2c, received 403"
UPDATE 2更新 2
Added docker version
and docker ps
for more info.添加了
docker version
和docker ps
以获取更多信息。 Output:输出:
docker version
Client: Docker Engine - Community
Cloud integration: 1.0.17
Version: 19.03.15
API version: 1.40
...
Server: Docker Engine - Community
Engine:
Version: 20.10.5
API version: 1.41 (minimum version 1.12)
...
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Is the docker daemon running? docker 守护进程是否正在运行? is a common error caused by so permissions, docker-in-docker, etc. Also this error is not related to docker-compose.
是由 so 权限、docker-in-docker 等引起的常见错误。此外,此错误与 docker-compose 无关。
In your case, you are executing docker commands inside of a docker container, so try to add this at the beginning of your pipeline:在您的情况下,您正在 docker 容器内执行 docker 命令,因此请尝试在管道的开头添加:
options:
docker: true
Check these solutions for Is the docker daemon running?检查这些解决方案是否正在运行 docker 守护进程? error:
错误:
Also I advice to try with a basic docker commands (simple build or run) before docker context with docker-compose configurations.此外,我建议在使用 docker-compose 配置的 docker 上下文之前尝试使用基本的 docker 命令(简单构建或运行)。 For example, a lot of users notify the same error (Is the docker daemon running?) when one of these commands are executed:
例如,当执行以下命令之一时,许多用户会通知相同的错误(是否 docker 守护程序正在运行?):
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.