A docker image based on Alpine Linux that includes Google Cloud SDK. To keep it small and minimal, it only installs gcloud core components and kubectl by default, but you can customize it based on your needs.
gcloud or kubectl to deploy into Google Cloud Platform or Kubernetes clusters.Just execute:
$ docker run -it iiriix/gcloud
You can mount configuration files as a volume to skip the authenticate step.
$ docker run --rm -it \
-v ~/.config/gcloud:/root/.config/gcloud \
iiriix/gcloud sh
$ docker run --rm -it \
-v ~/.config/gcloud:/root/.config/gcloud \
-v ~/.kube:/root/.kube \
iiriix/gcloud kubectl get pod
Set environment variables to the container to initialize and activate service account. Read more about Google Cloud Service Account.
Here is the list of variables:
$ docker run --rm -it \
-e "CLOUDSDK_SERVICE_ACCOUNT=$(base64 service-key.json)" \
-e "CLOUDSDK_PROJECT_NAME=myproject" \
-e "CLOUDSDK_COMPUTE_ZONE=europe-west1-b" \
-e "CLOUDSDK_CLUSTER_NAME=mycluster" \
iiriix/gcloud gcloud compute instances list
$ docker run --rm -it \
-v $(pwd)/service-key.json:/service-key.json \
-e "CLOUDSDK_SERVICE_ACCOUNT_FILE=/service-key.json" \
-e "CLOUDSDK_PROJECT_NAME=myproject" \
-e "CLOUDSDK_COMPUTE_ZONE=europe-west1-b" \
-e "CLOUDSDK_CLUSTER_NAME=mycluster" \
iiriix/gcloud kubectl get deploy
Mount docker socket into the container and run docker commands to build, push and etc.
$ docker run --rm -it \
-v /var/run/docker.sock:/var/run/docker.sock \
iiriix/gcloud docker ps
The init script looks for a file named /code/ci.sh and runs it when the container starts. This can be useful to put whatever you want to run inside the container in this file and just mount it as /code/ci.sh in the container.
$ docker run --rm -it \
-v /your_script.sh:/code/ci.sh \
iiriix/gcloud
Mount your code as /code. The /code/ci.sh script will be run in the container to build, test, push and deploy your code on your infrastructure:
$ docker run --rm -it \
-v $(pwd)/service-key.json:/service-key.json \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(pwd)/sample-nginx:/code \
-e "CLOUDSDK_SERVICE_ACCOUNT_FILE=/service-key.json" \
-e "CLOUDSDK_PROJECT_NAME=myproject" \
-e "CLOUDSDK_COMPUTE_ZONE=europe-west1-b" \
-e "CLOUDSDK_CLUSTER_NAME=mycluster" \
iiriix/gcloud
If you need to customize or build it yourself:
$ git clone https://github.com/iiriix/gcloud.git
$ cd gcloud
$ docker build -t iiriix/gcloud:customized .
$ docker run --rm -it iiriix/gcloud:customized
For bug reports or suggestion, please open an issue on GitHub.
Content type
Image
Digest
Size
92.7 MB
Last updated
over 9 years ago
docker pull iiriix/gcloud