Google Cloud SDK Docker
This is Docker image for the Google Cloud SDK.
:latest tag of this image is Debian-based and includes default command
line tools of Google Cloud SDK (
bq) as well as all
google/cloud-sdk:VERSION: (large image with
additional components pre-installed, Debian-based)
google/cloud-sdk:VERSION-slim: (smaller image with
no components pre-installed, Debian-based)
google/cloud-sdk:VERSION-alpine: (smallest image
with no additional components installed, Alpine-based)
→ Check out Docker Hub for available tags.
To use this image, pull from Docker Hub, run the following command:
docker pull google/cloud-sdk:latest
Verify the install
docker run -ti google/cloud-sdk:latest gcloud version Google Cloud SDK 159.0.0
or use a particular version number:
docker run -ti google/cloud-sdk:160.0.0 gcloud version
Then, authenticate by running:
docker run -ti --name gcloud-config google/cloud-sdk gcloud auth login
Once you authenticate successfully, credentials are preserved in the volume of
To list compute instances using these credentials, run the container with
docker run --rm -ti --volumes-from gcloud-config google/cloud-sdk gcloud compute instances list --project your_project NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS instance-1 us-central1-a n1-standard-1 10.240.0.2 220.127.116.11 RUNNING
:warning: Warning: The
gcloud-configcontainer now has a volume
containing your Google Cloud credentials. Do not use
Installing additional components
By default, all gcloud components
are installed on the default
google/cloud-sdk:alpine images do not contain
additional components pre-installed. You can extend these images by following
the instructions below:
cd debian_slim/ docker build --build-arg CLOUD_SDK_VERSION=159.0.0 \ --build-arg INSTALL_COMPONENTS="google-cloud-sdk-datastore-emulator" \ -t my-cloud-sdk-docker:slim .
To install additional components for Alpine-based images, create a Dockerfile
that uses the gcloud image as the base image. For example, to add
FROM google/cloud-sdk:alpine RUN apk --update add openjdk7-jre RUN gcloud components install app-engine-java kubectl
docker build -t my-cloud-sdk-docker:alpine .
Note that in this case, you have to install dependencies of additional
Legacy image (Google App Engine based)
The original image in this repository was based off of
The full Dockerfile for that can be found
here for archival as well as in image tag
You broke our build twice in the last week (once when you switched to Alpine Linux, and once when you switched back after we had changed things to work with Alpine Linux). Is there a mailing list or group we could subscribe to so that we will get a heads-up when things are about to change in a major way?
some trouble with gsutil, could not copy to storage file...
service account auth OK, gsutil cp file1 (file in home directory)
gsutil cp test.txt gs://idg-backup
CommandException: No URLs matched: test.txt
@micheleorsi did you figure it out?
Like also mentioned by @pantelism
gcloud beta emulators datastore start doesn't work
docker run --rm -ti --volumes-from gcloud-config google/cloud-sdk gcloud beta emulators datastore start WARNING: Your kernel does not support memory swappiness capabilities, memory swappiness discarded. You need the [gcd-emulator] component to use the Google Cloud Datastore emulator. You cannot perform this action because this Cloud SDK installation is managed by an external package manager. If you would like to get the latest version, please see our main download page at: https://developers.google.com/cloud/sdk/ ERROR: (gcloud.beta.emulators.datastore.start) The component manager is disabled for this installation
I have a problem running kubectl.
When I run
docker run --rm -ti --volumes-from testing google/cloud-sdk kubectl run wordpress --image=tutum/wordpress --port=80
I continue to get this error:
The connection to the server localhost:8080 was refused - did you specify the right host or port?
BTW: yes I run this before
docker run --rm -ti --volumes-from $(CONTAINER_NAME) google/cloud-sdk gcloud container clusters get-credentials $(CLUSTER_NAME)
I am using CircleCI to automate the build.
The only issue I am having is with this:
$ docker run -t -i --name gcloud-config google/cloud-sdk gcloud auth activate-service-account <your-service-account-email> --key-file /tmp/your-key.p12 --project <your-project-id>
When this runs, I get an error that the key-file can't be found. Basically, the docker container can't find the file in the host directory. How can I copy the key file from the host directory to the docker container when I run this? I tried using the
-v flag, but that did nothing.
The docker run commands shown are fine if you dont use preview components. If for example you want to execute the command
$docker run --rm -ti --volumes-from gcloud-config google/cloud-sdk gcloud preview docker pull gcr.io/<project-id>/<repo> the error that is returned is that ERROR: (gcloud.preview.docker) Docker is not installed. This is an expected behavior as docker is not installed in the image. Is there plan to address this issue ?
On Boot2Docker 1.3.2/OSX Mavericks/GCloud 0.9.37, I got the following error:
root@d43d618dc58f:/# gcloud auth login
Go to the following link in your browser:
Enter verification code: <blah-blah>
Traceback (most recent call last):
File "/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 170, in <module>
File "/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 166, in
File "/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 385, in Execute
File "/google-cloud-sdk/./lib/googlecloudsdk/calliope/frontend.py", line 274, in _Execute
File "/google-cloud-sdk/./lib/googlecloudsdk/calliope/backend.py", line 928, in Run
result = command_instance.Run(args)
File "/google-cloud-sdk/./lib/googlecloudsdk/calliope/exceptions.py", line 78, in TryFunc
return func(*args, **kwargs)
File "/google-cloud-sdk/lib/googlecloudsdk/gcloud/sdktools/auth/login.py", line 84, in Run
creds = self.DoWebFlow(args.launch_browser)
File "/google-cloud-sdk/lib/googlecloudsdk/gcloud/sdktools/auth/login.py", line 140, in DoWebFlow
File "/google-cloud-sdk/./lib/googlecloudsdk/core/credentials/store.py", line 339, in AcquireFromWebFlow
File "/google-cloud-sdk/./lib/googlecloudsdk/core/credentials/flow.py", line 156, in Run
credential = flow.step2_exchange(code, http=http)
File "/google-cloud-sdk/./lib/oauth2client/util.py", line 129, in positional_wrapper
return wrapped(*args, **kwargs)
File "/google-cloud-sdk/./lib/oauth2client/client.py", line 1825, in step2_exchange
File "/google-cloud-sdk/./lib/httplib2/init.py", line 1608, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "/google-cloud-sdk/./lib/httplib2/init.py", line 1350, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/google-cloud-sdk/./lib/httplib2/init.py", line 1278, in _conn_request
raise ServerNotFoundError("Unable to find the server at %s" % conn.host)
httplib2.ServerNotFoundError: Unable to find the server at accounts.google.com
Please advise. Thx.
It'd be helpful if these images were tagged with versions that correspond directly to versions of the cloud-sdk (also missing). This will help to create consistent and reproducible environments for developers.