Public | Automated Build

Last pushed: 11 hours ago
Short Description
Google Cloud SDKbundle with all components and dependencies
Full Description

Google Cloud SDK Docker

This is Docker image for the Google Cloud SDK.

The :latest tag of this image is Debian-based and includes default command
line tools of Google Cloud SDK (gcloud, gsutil, bq) as well as all
additional components.

Supported tags

  • google/cloud-sdk:latest, google/cloud-sdk:VERSION: (large image with
    additional components pre-installed, Debian-based)
  • google/cloud-sdk:slim, google/cloud-sdk:VERSION-slim: (smaller image with
    no components pre-installed, Debian-based)
  • google/cloud-sdk:alpine, google/cloud-sdk:VERSION-alpine: (smallest image
    with no additional components installed, Alpine-based)

→ Check out Docker Hub for available tags.



Usage

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
the gcloud-config container.

To list compute instances using these credentials, run the container with
--volumes-from:

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   8.34.219.29      RUNNING

:warning: Warning: The gcloud-config container now has a volume
containing your Google Cloud credentials. Do not use gcloud-config volume in
other containers.

Installing additional components

By default, all gcloud components
are
installed on the default
images (google/cloud-sdk:latest and google/cloud-sdk:VERSION).

The google/cloud-sdk:slim and google/cloud-sdk:alpine images do not contain
additional components pre-installed. You can extend these images by following
the instructions below:

Debian-based images

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 .

Alpine-based images

To install additional components for Alpine-based images, create a Dockerfile
that uses the gcloud image as the base image. For example, to add kubectl and
app-engine-java components:

FROM google/cloud-sdk:alpine
RUN apk --update add openjdk7-jre
RUN gcloud components install app-engine-java kubectl

and run:

docker build  -t my-cloud-sdk-docker:alpine .

Note that in this case, you have to install dependencies of additional
components manually.

Legacy image (Google App Engine based)

The original image in this repository was based off of

FROM gcr.io/google_appengine/base

The full Dockerfile for that can be found
here for archival as well as in image tag
google/cloud-sdk-docker:legacy

Docker Pull Command
Owner
google

Comments (10)
pboothe
4 months ago

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?

unfii
5 months ago

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

kilianciuffolo
a year ago

@micheleorsi did you figure it out?

cliffordkeeney
a year ago

I opened an issue and pull request regarding the missing beta components.

It is available here:

https://github.com/GoogleCloudPlatform/cloud-sdk-docker/issues/42

zoechi
2 years ago

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
micheleorsi
2 years ago

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)
zacharynevin
2 years ago

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.

Thank you!

pantelism
3 years ago

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 ?

clearpursuitdocker
3 years ago

Hi guys,
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:

https://accounts.google.com/o/oauth2/auth?<blah-blah>

Enter verification code: <blah-blah>

Traceback (most recent call last):

File "/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 170, in <module>

main()

File "/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 166, in
main

_cli.Execute()

File "/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 385, in Execute

post_run_hooks=self.__post_run_hooks, kwargs=kwargs)

File "/google-cloud-sdk/./lib/googlecloudsdk/calliope/frontend.py", line 274, in _Execute

pre_run_hooks=pre_run_hooks, post_run_hooks=post_run_hooks)

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

return c_store.AcquireFromWebFlow(launch_browser=launch_browser)

File "/google-cloud-sdk/./lib/googlecloudsdk/core/credentials/store.py", line 339, in AcquireFromWebFlow

http=_Http())

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
headers=headers)

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.

erichiggins
3 years ago

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.