Public | Automated Build

Last pushed: 18 days ago
Short Description
Google Cloud SDKbundle with all components and dependencies
Full Description

cloud-sdk-docker

:warning: IMPORTANT NOTE: The base image for the cloud-sdk image will be changed to Alpine Linux on or after 5/15/17.

For more information, please see: #58

google/cloud-sdk is a
Docker image bundling all the components and dependencies
of the Google Cloud SDK including alpha and
beta components.

Usage

Follow these instructions if you are running docker outside of Google Compute Engine:

# Get the cloud sdk image:
$ docker pull google/cloud-sdk

# Auth & save the credentials in gcloud-config volumes:
$ docker run -t -i --name gcloud-config google/cloud-sdk gcloud init

# If you would like to use service account instead please look here:
$ 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>

# Re-use the credentials from gcloud-config volumes & run sdk commands:
$ docker run --rm -ti --volumes-from gcloud-config google/cloud-sdk gcloud info
$ docker run --rm -ti --volumes-from gcloud-config google/cloud-sdk gcloud components list
$ docker run --rm -ti --volumes-from gcloud-config google/cloud-sdk gcloud compute instances list
$ docker run --rm -ti --volumes-from gcloud-config google/cloud-sdk gsutil ls

If you are using this image from within Google Compute
Engine
. If you enable a Service Account with
the necessary scopes, there is no need to auth or use a config volume:

# Get the cloud sdk image:
$ docker pull google/cloud-sdk

# Just start using the sdk commands:
$ docker run --rm -ti google/cloud-sdk gcloud info
$ docker run --rm -ti google/cloud-sdk gcloud components list
$ docker run --rm -ti google/cloud-sdk gcutil listinstances
$ docker run --rm -ti google/cloud-sdk gsutil ls
Docker Pull Command
Owner
google

Comments (9)
unfii
8 days 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
6 months ago

@micheleorsi did you figure it out?

cliffordkeeney
10 months 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
a year 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
a year 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
2 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
2 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.