Quick cheat sheet for building Docker images and pushing them to GCR.
Build the Image
docker build -t <image_name>:<image_version> .
If you’re on Apple Silicon (M1/M2), target x86 to avoid surprises on Linux:
docker build --platform linux/amd64 -t <image_name>:<image_version> .
List local images:
docker images
Tag for GCR
docker tag <image_id> gcr.io/<project_id>/<repo_name>:<image_version>
Replace <image_id>
with the ID from docker images
.
Push
docker push gcr.io/<project_id>/<repo_name>:<image_version>
Make sure you’re authenticated (gcloud auth configure-docker
) before pushing. That’s it! ***