Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Facing error while building docker image in bitbucket pipeline


Please find the error below

error during connect: Get "http://docker:2375/v1.24/version": dial tcp: lookup docker on no such host

1 answer

0 votes

Welcome to the Community!

That means what it says; nothing is responding to your call on the URL you have given it.  You'll need to change it to use the actual address of the host you're trying to reach.

Can you help me out in this? Actually we are trying to shift from Gitlab to Bitbucket.

I have created a runner on Google Kubernetes Engine. We use Google container registry as to save our docker images. I.m trying to setup a pipeline where my image gets build and pushed to google container registry.

This is my bitbucket-pipelines.yml file . Go through it might be you get some idea what I am trying to achieve.


      image: docker:20.10.7-dind
        DOCKER_OPTS: "--mtu=1300"
        DOCKER_DRIVER: overlay2
        DOCKER_HOST: tcp://docker:2375
      - step:
          name: publish
          image: docker:latest
            - 'self.hosted'
            - 'linux'          
 #           - export ENVIRONMENT=uat          
            - apk add --update make ca-certificates openssl build-base python3-dev python3 libffi-dev libressl-dev bash git gettext curl
            - update-ca-certificates
            - echo $GCLOUD_SERVICE_KEY > ${HOME}/gcloud-service-key.json
            - tar zxf google-cloud-sdk.tar.gz && ./google-cloud-sdk/ --usage-reporting=false --path-update=true
            - google-cloud-sdk/bin/gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json
            - docker version
            - docker login -u _json_key --password-stdin < ${HOME}/gcloud-service-key.json
            - docker build -t $IMAGE_NAME .
            - docker tag $IMAGE_NAME "$GCLOUD_PROJECT_ID/$IMAGE_NAME:$(echo $CI_COMMIT_SHA | cut -c1-8)"
            - docker push "$GCLOUD_PROJECT_ID/$IMAGE_NAME:$(echo $CI_COMMIT_SHA | cut -c1-8)"
            - docker

      - step:
          name: Deploy
          image: google/cloud-sdk:alpine
            - 'self.hosted'
            - 'linux'          
           - echo $GCLOUD_SERVICE_KEY_KUBE > ${HOME}/gcloud-service-key.json
           - gcloud components install kubectl
           - gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json  --project $GCLOUD_PROJECT_ID
           - gcloud container clusters get-credentials $CLUSTER_NAME --zone $CLUSTER_ZONE
           - kubectl -n $ENVIRONMENT set image deployment/$K8S_DEPLOYMENT $$GCLOUD_PROJECT_ID/$IMAGE_NAME:$(echo $CI_COMMIT_SHA | cut -c1-8)
             - docker
  docker: true

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

⭐ Calling all Bitbucket and DevOps experts: Special showcase opportunity ⭐

Hi, Bitbucket community! Are you a DevOps practitioner (or know one in your network)? Do you have DevOps tips, tricks, or learnings you'd like to share with the community? If so, we'd love to hea...

1,480 views 4 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you