base-images-docker icon indicating copy to clipboard operation
base-images-docker copied to clipboard

Make 'apt-get install google-cloud-sdk' just work

Open duggelz opened this issue 8 years ago • 13 comments

This page has a six-step process for installing 'gcloud', including one that doesn't work on this image (The step with lsb_release).

https://cloud.google.com/sdk/downloads

This image should already have the apt database setup with the correct paths, repositories, and keys.

duggelz avatar Nov 02 '16 02:11 duggelz

Installing lsb_release would add around 20MB:

The following extra packages will be installed:
  libexpat1 libffi6 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libsqlite3-0 mime-support python python-minimal python2.7 python2.7-minimal
Suggested packages:
  lsb python-doc python-tk python2.7-doc binutils binfmt-support
Recommended packages:
  file
The following NEW packages will be installed:
  libexpat1 libffi6 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libsqlite3-0 lsb-release mime-support python python-minimal python2.7 python2.7-minimal
0 upgraded, 12 newly installed, 0 to remove and 14 not upgraded.
Need to get 4690 kB of archives.
After this operation, 18.1 MB of additional disk space will be used.

I'm inclined to leave it out, but making "apt-get install google-cloud-sdk" work should just work.

dlorenc avatar Aug 29 '17 15:08 dlorenc

Doh. I agree it's not worth 30% increase in base image size. However, in this case, we can replace the 20MB with $(echo jessie).

In the debian-docker repo, it looks like there is already a $VERSION set to jessie or stretch, so a little fiddling with envsubst seems like it would do the job.

duggelz avatar Aug 29 '17 18:08 duggelz

The next problem after lsb_release is curl, there is no curl or wget equivalent that I see to fetch the key file via https. So maybe we bake that into the image at build time. Since you have some sweeping build changes going on (+1 to reproducible builds BTW), I'll let this go for now.

duggelz avatar Aug 30 '17 00:08 duggelz

So thinking about this again, we can make "apt-get install google-cloud-sdk" just work by adding the apt repo by default, but that still won't fix things for users that follow the docs (and hit a missing lsb_release, among other things).

Any thoughts?

dlorenc avatar Oct 10 '17 21:10 dlorenc

If we bake steps 1-3 of the install process into the image, I think we just update the installation docs to say "if using App Engine/GKE/GCF/Prime, skip to step 4". There's already a note about GCE, we just make that note longer.

duggelz avatar Nov 08 '17 02:11 duggelz

Is it solved?

dedeco avatar Jan 17 '18 12:01 dedeco

Unfortunately no.

duggelz avatar Jan 17 '18 20:01 duggelz

@duggelz @dedeco Does the following maybe help you out? https://github.com/GoogleCloudPlatform/cloud-sdk-docker

YaguraStation avatar May 25 '18 14:05 YaguraStation

@YaguraStation Thank you for you advice, but I decided run my models locally.

dedeco avatar May 26 '18 20:05 dedeco

It looks like installing "google-cloud-sdk" is working. Maybe I'm not installing the full suite of it. But basic usage of gcloud and gsutil, etc works fine. You just need to add the additional deb repo and gpg key. There is a experimental version of using rules_docker here (https://github.com/bazelbuild/bazel-toolchains/blob/master/container/ubuntu16_04/layers/gcloud/BUILD#L32 ) and a version that uses Dockerfile here (https://github.com/bazelbuild/rules_k8s/blob/master/images/gcloud-bazel/Dockerfile#L46).

xingao267 avatar Jul 31 '18 19:07 xingao267

I ran into this issue and the issue was that the doc was wrong. According to the google's documentation, the /etc/apt/sources.list.d/google-cloud-sdk.list should contain deb http://packages.cloud.google.com/apt stretch main. ( I am using debian stretch ) But this is throwing 404. However, I looked through their repository and the correct name is cloud-sdk-<distro name> or in my case cloud-sdk-stretch.

So, right now this is what I do for stretch and works fine for me

echo "deb http://packages.cloud.google.com/apt cloud-sdk-stretch main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
    curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \
    apt-get update -y && apt-get install google-cloud-sdk -y

MansoorMajeed avatar Apr 04 '19 05:04 MansoorMajeed

Absolutely Debian based google cloud sdk image would do a lot. +1

thesayyn avatar Apr 29 '19 15:04 thesayyn

The official documentation - Installing with apt-get (Debian and Ubuntu only) is available now.

MonicaPC1 avatar Aug 06 '19 01:08 MonicaPC1