base-images-docker
base-images-docker copied to clipboard
Make 'apt-get install google-cloud-sdk' just work
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.
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.
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.
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.
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?
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.
Is it solved?
Unfortunately no.
@duggelz @dedeco Does the following maybe help you out? https://github.com/GoogleCloudPlatform/cloud-sdk-docker
@YaguraStation Thank you for you advice, but I decided run my models locally.
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).
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
Absolutely Debian based google cloud sdk image would do a lot. +1
The official documentation - Installing with apt-get (Debian and Ubuntu only) is available now.