Home > database >  How to build/tag an existing Docker image in Cloud Builder
How to build/tag an existing Docker image in Cloud Builder

Time:07-14

I currently use Cloud Build to build my app as a Docker image based on a Dockerfile. All this works fine.

However, I would like to build/push an existing image (without a Dockerfile): quay.io/soketi/soketi:1.0-16-debian

How can I instruct Cloud Build to tag/push the above Docker image hosted on quay.io?

Once I push the image, I will create a Cloud Run based on the socket image.

Thank you

CodePudding user response:

You can do it directly by pulling the image, add the new tag and push it to the new registry in one step:

steps:
- name: 'gcr.io/cloud-builders/docker'
  entrypoint: 'bash'
  args:
  - '-eEuo'
  - 'pipefail'
  - '-c'
  - |-
    docker pull quay.io/soketi/soketi:1.0-16-debian && \
    docker tag quay.io/soketi/soketi:1.0-16-debian gcr.io/PROJECT_ID/soketi:1.0-16-debian && \
    docker push gcr.io/PROJECT_ID/soketi:1.0-16-debian

Of course you can change the registry and only if you want to re-tag the image

CodePudding user response:

I would create an image from the Dockerfile containing one line:

FROM quay.io/soketi/soketi:1.0-16-debian

and push it (submit) with a desired tag.

  • Related