1

I want to deploy container group to Azure Container Instances from bitbucket pipelines. I have following bitbucket-pipelines.yml file:

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:

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.

I tried adding export DOCKER_HOST="tcp://0.0.0.0:2375" before docker compose up but it didn't help.

Is there something I am missing?

UPDATE 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"

UPDATE 2

Added docker version and docker ps for more info. 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
Ramūnas
  • 1,494
  • 18
  • 37

1 Answers1

0

Is the docker daemon running? is a common error caused by s.o permissions, docker-in-docker, etc. Also this error is not related to 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:

options:
  docker: true

Check these solutions for Is the docker daemon running? error:

Also I advice to try with a basic docker commands (simple build or run) before docker context with docker-compose configurations. For example, a lot of users notify the same error (Is the docker daemon running?) when one of these commands are executed:

  • docker info
  • docker run ...
  • docker ps
JRichardsz
  • 14,356
  • 6
  • 59
  • 94
  • I have enabled docker with another command. See last two lines of my `bitbucket-pipelines.yml` file. (Those should produce the same result). I also executed `docker version` and `docker ps` and updated my question with result of those commands. I also tried buiding docker image and it worked fine, so the only thing that is not working is `docker-compose` – Ramūnas Jul 13 '21 at 12:11