Facing error while building docker image in bitbucket pipeline

Priyank Keni December 24, 2021

 

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
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 24, 2021

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.

Priyank Keni December 26, 2021

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.

Priyank Keni December 26, 2021

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
AUG Leaders

Atlassian Community Events