I have a Docker container as 19.10 as both the host and guest, and I tried to install gcloud:
# Add the Cloud SDK distribution URI as a package source
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
# Fix the zany problem of user apt not being able to access a file from curl
# https://askubuntu.com/questions/908800/what-does-this-synaptic-error-message-mean
RUN chown -R _apt:root /var/lib/apt/lists
# Import the Google Cloud Platform public key
RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
# Update the package list and install the Cloud SDK
RUN apt update && apt install -qy google-cloud-sdk
I get the following error:
Step 7/8 : RUN apt update && apt install -qy google-cloud-sdk
---> Running in c1e06f8c1130
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Get:1 http://packages.cloud.google.com/apt cloud-sdk InRelease [6343 B]
Get:2 http://packages.cloud.google.com/apt cloud-sdk/main amd64 Packages [108 kB]
Hit:3 http://archive.ubuntu.com/ubuntu eoan InRelease
Fetched 114 kB in 1s (185 kB/s)
Reading package lists...
Building dependency tree...
Reading state information...
All packages are up to date.
W: Download is performed unsandboxed as root as file '/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_eoan_InRelease' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
google-cloud-sdk : Depends: python2.7 but it is not installable
Recommends: python-crcmod but it is not installable
E: Unable to correct problems, you have held broken packages.
The command '/bin/sh -c apt update && apt install -qy google-cloud-sdk' returned a non-zero code: 100
make: *** [Makefile:4: build] Error 100
How do I fix this?
Manually installing Python2.7 solved the issue. But since Python2.7 wasn't in the default repos on this image, I had to add them.
Adding the following lines before attempting to install gcloud solved my issue: