Ark-kun
Ark-kun

Reputation: 6787

Mirror Docker container image to Google Container Registry using least dependencies/permissions

I need to perform the following from a python program:

docker pull foo/bar:tag
docker tag foo/bar:tag gcr.io/project_id/mirror/foo/bar:tag
gcloud auth configure-docker --quiet
docker push gcr.io/project_id/mirror/foo/bar:tag

I want to accomplish this with the minimal possible footprint - no root, no privileged Docker installation, etc. The Google Cloud SDK is installed.

How to programmatically mirror the image with minimal app footprint?

Upvotes: 0

Views: 549

Answers (1)

Ajit Singh
Ajit Singh

Reputation: 70

Google cloud build API can be used to perform all your required steps in one command Or use Trigger.

  1. gcloud builds submit --tag gcr.io/$DEVSHELL_PROJECT_ID/$UMAGE_NAME:v0.1 .

Above command, you can call using Python cloud Build API https://googleapis.dev/python/cloudbuild/latest/gapic/v1/api.html

Upvotes: 2

Related Questions