1

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?

1

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:

RUN echo "deb http://us.archive.ubuntu.com/ubuntu/ eoan universe" | tee -a /etc/apt/sources.list.d/python27.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

RUN apt update

RUN apt install -qy curl git screen vim gnupg python2.7
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.