Giter VIP home page Giter VIP logo

cloud-sdk-docker's Introduction

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.

Docker Pulls Docker Build Status Docker Automated buil

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: The gcloud-config container now has a volume containing your Google Cloud credentials. Do not use gcloud-config volume in other containers.

Alternatively, you can use use auth/credential_file_override property to set a path to a mounted service account and then the config to read that using CLOUDSDK_CONFIG environment variable.

for example, mycloud configuration below has the auth/credential_file_override already set and points towards a certificate file that will be present within the container as a separate volume mount.

See issue#152

$ docker run -ti -e CLOUDSDK_CONFIG=/config/mygcloud \
                 -v `pwd`/mygcloud:/config/mygcloud \
                 -v `pwd`:/certs  google/cloud-sdk:alpine /bin/bash

bash-4.4# gcloud config list
[auth]
credential_file_override = /certs/svc_account.json

bash-4.4# head -10  /certs/svc_account.json
{
  "type": "service_account",
  "project_id": "project_id1",
....

bash-4.4# gcloud projects list
PROJECT_ID           NAME         PROJECT_NUMBER
project_id1          GCPAppID     1071284184432

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.

Installing different version of gcloud sdk:

docker build -t my-cloud-sdk-docker:alpine --build-arg CLOUD_SDK_VERSION=<release_number> .

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

Cloud SDK Release Tracking

You can also follow the Cloud SDK Release schedule here

cloud-sdk-docker's People

Contributors

ahmetb avatar amalhotragannett avatar chansuke avatar ckeeney avatar cloudsdkdocker avatar dgageot avatar dlorenc avatar erjohnso avatar euank avatar jacek-marchwicki avatar jmbataller avatar ludoch avatar mattmoor avatar proppy avatar salrashid123 avatar seano314 avatar skelterjohn avatar svalentin avatar timkaye11 avatar tswast avatar zchee avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.