Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,368,017
Community Members
 
Community Events
168
Community Groups

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 10.32.0.10:53: 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.

 

definitions:
  services:
     docker:
      image: docker:20.10.7-dind
      variables:
        DOCKER_OPTS: "--mtu=1300"
        DOCKER_DRIVER: overlay2
        DOCKER_HOST: tcp://docker:2375
        DOCKER_TLS_CERTDIR: ""
       
pipelines:
  default:
      - step:
          name: publish
          image: docker:latest
          runs-on:
            - 'self.hosted'
            - 'linux'          
          script:
 #           - export IMAGE_NAME=asia.gcr.io/$GCLOUD_PROJECT/$BITBUCKET_REPO_SLUG:$BITBUCKET_COMMIT
 #           - 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/install.sh --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 https://asia.gcr.io < ${HOME}/gcloud-service-key.json
            - docker build -t $IMAGE_NAME .
            - docker tag $IMAGE_NAME "asia.gcr.io/$GCLOUD_PROJECT_ID/$IMAGE_NAME:$(echo $CI_COMMIT_SHA | cut -c1-8)"
            - docker push "asia.gcr.io/$GCLOUD_PROJECT_ID/$IMAGE_NAME:$(echo $CI_COMMIT_SHA | cut -c1-8)"
          services:
            - docker

      - step:
          name: Deploy
          image: google/cloud-sdk:alpine
          runs-on:
            - 'self.hosted'
            - 'linux'          
          script:
           - 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 $K8S_IMAGE=asia.gcr.io/$GCLOUD_PROJECT_ID/$IMAGE_NAME:$(echo $CI_COMMIT_SHA | cut -c1-8)
          services:
             - docker
           
options:
  docker: true

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events