Cannot build Docker images any more - linux

I am having an issue with my Ubuntu 20 PC. So far I have used Docker frequently, however lately I cannot build any docker image any more.
The problem is when a Dockerfile has the usual RUN commands
RUN apt-get update && apt-get remove -y x264 libx264-dev
RUN apt-get update && apt-get upgrade -y && apt-get install -y sudo clang-format wget apt-utils
Well, RUN apt-get update fails every time with
Err:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Temporary failure resolving 'security.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu xenial InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:3 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 InRelease
Could not resolve host: developer.download.nvidia.com
Err:4 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:5 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Temporary failure resolving 'archive.ubuntu.com'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease Temporary failure resolving 'security.ubuntu.com'
W: Failed to fetch https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/InRelease Could not resolve host: developer.download.nvidia.com
W: Some index files failed to download. They have been ignored, or old ones used instead.
What could be happening here?
I remember once I had a similar problem and a reboot fixed it but not this time.

Related

Permission denied while installing Node.js v14.10.0 on Ubuntu 20.4

Hello and thanks for looking at this issue.
So I'm trying to install version node.js v14.10.0. NVM installed without any problems, but when I ran -
nvm install v14.10.0
and I got this error
Downloading and installing node v14.10.0...
Downloading https://nodejs.org/dist/v14.10.0/node-v14.10.0-linux-x64.tar.xz...
Warning: Failed to create the file
Warning: /home/revolverclyde/.nvm/.cache/bin/node-v14.10.0-linux-x64/node-v14.1
Warning: 0.0-linux-x64.tar.xz: Permission denied
0.0%curl: (23) Failure writing output to destination
Binary download from https://nodejs.org/dist/v14.10.0/node-v14.10.0-linux-x64.tar.xz failed, trying source.
grep: /home/revolverclyde/.nvm/.cache/bin/node-v14.10.0-linux-x64/node-v14.10.0-linux-x64.tar.xz: No such file or directory
Provided file to checksum does not exist.
Binary download failed, trying source.
Downloading https://nodejs.org/dist/v14.10.0/node-v14.10.0.tar.xz...
Warning: Failed to create the file
Warning: /home/revolverclyde/.nvm/.cache/src/node-v14.10.0/node-v14.10.0.tar.xz
Warning: : Permission denied
0.0%curl: (23) Failure writing output to destination
Binary download from https://nodejs.org/dist/v14.10.0/node-v14.10.0.tar.xz failed, trying source.
grep: /home/revolverclyde/.nvm/.cache/src/node-v14.10.0/node-v14.10.0.tar.xz: No such file or directory
Provided file to checksum does not exist.
Any suggestions?
Thanks!
UPDATE!!
The error I'm getting above may have something do to with an error I got while installing NodeSource. I'm new to this maybe I'm wrong, but I thought it would be helpful to know anyway.
$ curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
## Installing the NodeSource Node.js 14.x repo...
## Populating apt-get cache...
+ apt-get update
Hit:1 http://dl.google.com/linux/chrome/deb stable InRelease
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Ign:3 http://ppa.launchpad.net/me-davidsansome/clementine/ubuntu focal InRelease
Ign:4 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 InRelease
Hit:5 http://us.archive.ubuntu.com/ubuntu focal InRelease
Ign:6 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 InRelease
Hit:7 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 Release
Get:8 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Hit:9 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 Release
Err:10 http://ppa.launchpad.net/me-davidsansome/clementine/ubuntu focal Release
404 Not Found [IP: 91.189.95.85 80]
Get:12 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/me-davidsansome/clementine/ubuntu focal Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Error executing command, exiting
"Err:10 http://ppa.launchpad.net/me-davidsansome/clementine/ubuntu focal Release
404 Not Found [IP: 91.189.95.85 80]" is the specific error if you don't want to hurt your eyes with the dense readout.
Fixed. I am quoting another poster here. I want to give Vishnu the credit.
"I had the same issue. It was due to the lack of "libssl-dev". Run the following command before you start the installation process for nvm
sudo apt-get install build-essential libssl-dev curl git-core"
It's a permission error. You can try to run it with the sudo command.
sudo nvm install v14.10.0

apt-get update fails inside Dockerfile

When I try to build a simple docker image:
in Dockerfile:
FROM ubuntu:18.04
RUN apt-get update
The output is:
$ sudo docker build --no-cache -t testbuild .
Sending build context to Docker daemon 3.471MB
Step 1/2 : FROM ubuntu:18.04
---> c090eaba6b94
Step 2/2 : RUN apt-get update
---> Running in 53d64603442f
Ign:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Ign:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
Ign:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Err:4 http://security.ubuntu.com/ubuntu bionic-security Release
404 Not Found [IP: 91.189.88.142 80]
Ign:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Err:6 http://archive.ubuntu.com/ubuntu bionic Release
404 Not Found [IP: 91.189.88.152 80]
Err:7 http://archive.ubuntu.com/ubuntu bionic-updates Release
404 Not Found [IP: 91.189.88.152 80]
Err:8 http://archive.ubuntu.com/ubuntu bionic-backports Release
404 Not Found [IP: 91.189.88.152 80]
Reading package lists...
E: The repository 'http://security.ubuntu.com/ubuntu bionic-security Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic-updates Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic-backports Release' does not have a Release file.
The command '/bin/sh -c apt-get update' returned a non-zero code: 100
I tried:
build with different types of ubuntu images - e.g. ubuntu:16.04, 18.04,20.04 - and get a similar error '...Release' does not have a Release file.'
I completely removed and reinstalled docker from my system, inc all containers and repository, and rebooted, and get the same error
I previously built multiple docker images and everything worked fine. And now I get this error out of nowhere all the time.

Unable to update GitLab CE from 13.4.3 to 13.5.4

I've a Ubuntu Server 20.04.01 LTS machine with a GitLab CE (v13.4.3) installed less than a year ago.
I'm not able to update to the new 13.5.4 version because apt tell me that all packages are up to date.
ebenedos#fcssrv-git:~$ sudo apt-get update && sudo apt-get install gitlab-ce
Hit:1 http://it.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://it.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://it.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:4 http://it.archive.ubuntu.com/ubuntu focal-security InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
gitlab-ce is already the newest version (13.4.3-ce.0).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
I've also tried to check for missing migrations but seems that it's all ok
ebenedos#fcssrv-git:~$ sudo gitlab-rails runner -e production 'puts Gitlab::BackgroundMigration.remaining'
0
Also tried to force the update to an updated bugfix version before updating to 13.5.4
ebenedos#fcssrv-git:~$ sudo apt-get update && sudo apt-get install gitlab-ce=gitlab-ce_13.4.6-ce.0
Hit:1 http://it.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://it.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://it.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:4 http://it.archive.ubuntu.com/ubuntu focal-security InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Version 'gitlab-ce_13.4.6-ce.0' for 'gitlab-ce' was not found
Finally I understand that the problem was related to old PPA. Probably Gitlab team has been updated them, the solution is to manually update PPA with:
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
And now update system restart working
ebenedos#fcssrv-git:~$ curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
Detected operating system as Ubuntu/focal.
Checking for curl...
Detected curl...
Checking for gpg...
Detected gpg...
Running apt-get update... done.
Installing apt-transport-https... done.
Installing /etc/apt/sources.list.d/gitlab_gitlab-ce.list...done.
Importing packagecloud gpg key... done.
Running apt-get update... done.
The repository is setup! You can now install packages.
ebenedos#fcssrv-git:~$ sudo apt update
Hit:1 http://it.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://it.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://it.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:4 http://it.archive.ubuntu.com/ubuntu focal-security InRelease
Hit:5 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu focal InRelease
Hit:6 https://packages.gitlab.com/gitlab/gitlab-ee/ubuntu focal InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
ebenedos#fcssrv-git:~$ sudo apt list --upgradable
Listing... Done
gitlab-ce/focal 13.5.4-ce.0 amd64 [upgradable from: 13.4.3-ce.0]
N: There are 33 additional versions. Please use the '-a' switch to see them.

I can't install python packages by using pip3 on alpine

Could not install packages due to an EnvironmentError: [Errno 39] Directory not empty: '/tmp/pip-install-xo15v1tw/mock/mock'
I created an alpine container. Dockerfile is
FROM alpine:latest
I built and run it.
#sudo docker build -t alpine .
#sudo docker run -it alpine
Then, I installed python3
#apk add python3
Then, I tried to install mock package and I got error.
#pip3 install mock
...
Could not install packages due to an EnvironmentError: [Errno 39] Directory not empty: '/tmp/pip-install-xo15v1tw/mock/mock'
I tried to install other python packages, but I always got the same error.
I'm running on the container on WSL. The version of alpine is 3.9.4.
How do I solve this problem?
I had the exact same issue running Docker (version 17.09.0 in Ubuntu 16.04, and version 18.06.1 in Ubuntu 18.04) in WSL on Windows 1903, build 18362.145 (my test example is below).
The problem appears to be related to the default overlay2 (and also affects the older overlay) storage driver. Changing to the vfs storage driver by adding the following to /etc/docker/daemon.json makes pip work correctly:
{
"storage-driver": "vfs"
}
However, the vfs storage driver is not recommended due to it's poor performance and high disk usage (it creates a complete copy of the file system in each layer). This is particularly relevant for docker builds where a complete copy of the file system is made for each line in the Dockerfile. So I'm not sure if this is a solution, but it at least indicates where the problem comes from. No other storage drivers appear to be compatible with WSL.
Following are two completely different situations where the overlay2/overlay storage driver appears to cause errors that do not appear to be related to storage at all. I'm sure this would also cause many other errors. I'm not sure if this was an issue before Windows 1903 (I didn't try docker in WSL then), and I'm also not sure what could be causing this (is it on the WSL side, or the overlay2/overlay side? - maybe someone with more knowledge than me would have a comment on this).
My test when using the overlay2/overlay storage driver is as follows:
$ docker run -it alpine
/ # apk add --update py3-pip
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
(1/11) Installing libbz2 (1.0.6-r6)
(2/11) Installing expat (2.2.6-r0)
(3/11) Installing libffi (3.2.1-r6)
(4/11) Installing gdbm (1.13-r1)
(5/11) Installing xz-libs (5.2.4-r0)
(6/11) Installing ncurses-terminfo-base (6.1_p20190105-r0)
(7/11) Installing ncurses-terminfo (6.1_p20190105-r0)
(8/11) Installing ncurses-libs (6.1_p20190105-r0)
(9/11) Installing readline (7.0.003-r1)
(10/11) Installing sqlite-libs (3.28.0-r0)
(11/11) Installing python3 (3.6.8-r2)
Executing busybox-1.29.3-r10.trigger
OK: 68 MiB in 25 packages
/ # pip3 install mock
Collecting mock
Downloading https://files.pythonhosted.org/packages/05/d2/f94e68be6b17f46d2c353564da56e6fb89ef09faeeff3313a046cb810ca9/mock-3.0.5-py2.py3-none-any.whl
Could not install packages due to an EnvironmentError: [Errno 39] Directory not empty: '/tmp/pip-install-btvxatk0/mock/mock'
/ #
When using the vfs storage driver:
$ docker run -it alpine
/ # apk add --update py3-pip
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
(1/11) Installing libbz2 (1.0.6-r6)
(2/11) Installing expat (2.2.6-r0)
(3/11) Installing libffi (3.2.1-r6)
(4/11) Installing gdbm (1.13-r1)
(5/11) Installing xz-libs (5.2.4-r0)
(6/11) Installing ncurses-terminfo-base (6.1_p20190105-r0)
(7/11) Installing ncurses-terminfo (6.1_p20190105-r0)
(8/11) Installing ncurses-libs (6.1_p20190105-r0)
(9/11) Installing readline (7.0.003-r1)
(10/11) Installing sqlite-libs (3.28.0-r0)
(11/11) Installing python3 (3.6.8-r2)
Executing busybox-1.29.3-r10.trigger
OK: 68 MiB in 25 packages
/ # pip3 install mock
Collecting mock
Downloading https://files.pythonhosted.org/packages/05/d2/f94e68be6b17f46d2c353564da56e6fb89ef09faeeff3313a046cb810ca9/mock-3.0.5-py2.py3-none-any.whl
Collecting six (from mock)
Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Installing collected packages: six, mock
Successfully installed mock-3.0.5 six-1.12.0
You are using pip version 18.1, however version 19.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
/ #
I also found that running apt update in the ububtu official image, I got the following output when using the overlay2/overlay storage driver:
$ docker run -it ubuntu
root#d716ab2aee5c:/# apt update
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
At least one invalid signature was encountered.
Err:2 http://archive.ubuntu.com/ubuntu bionic InRelease
At least one invalid signature was encountered.
Get:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
At least one invalid signature was encountered.
Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
At least one invalid signature was encountered.
Reading package lists... Done
W: GPG error: http://security.ubuntu.com/ubuntu bionic-security InRelease: At least one invalid signature was encountered.
E: The repository 'http://security.ubuntu.com/ubuntu bionic-security InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://archive.ubuntu.com/ubuntu bionic InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://archive.ubuntu.com/ubuntu bionic-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://archive.ubuntu.com/ubuntu bionic-backports InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic-backports InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
root#d716ab2aee5c:/#
When using the vfs storage driver:
$ docker run -it ubuntu
root#1422a0121aa2:/# apt update
Get:1 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:5 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [717 kB]
Get:6 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [5436 B]
Get:7 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [535 kB]
Get:8 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1344 kB]
Get:9 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [4169 B]
Get:10 http://archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [13.5 kB]
Get:11 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [11.3 MB]
Get:12 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [186 kB]
Get:13 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1220 kB]
Get:14 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [10.8 kB]
Get:15 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [7239 B]
Get:16 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [837 kB]
Get:17 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [3902 B]
Get:18 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [2496 B]
Fetched 16.7 MB in 26s (641 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
12 packages can be upgraded. Run 'apt list --upgradable' to see them.
root#1422a0121aa2:/#

docker apt-get update error

My dockerfile
FROM node:argon
# Set the locale
RUN apt-get clean && apt-get update
RUN apt-get install locales
RUN locale-gen en_US.UTF-8
9 out of 10 times, it can not be built with the error below.
Sending build context to Docker daemon 73.95 MB
Step 1 : FROM node:argon
---> 10a26800d95a
Step 2 : RUN apt-get clean && apt-get update
---> Running in 5a41dd8ab15e
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Get:2 http://security.debian.org jessie/updates/main amd64 Packages [390 kB]
Ign http://httpredir.debian.org jessie InRelease
Err http://httpredir.debian.org jessie Release.gpg
Error reading from server. Remote end closed connection [IP: 5.153.231.35 80]
Get:3 http://httpredir.debian.org jessie-updates InRelease [142 kB]
Err http://httpredir.debian.org jessie-updates/main amd64 Packages
Get:4 http://httpredir.debian.org jessie Release [148 kB]
Err http://httpredir.debian.org jessie-updates/main amd64 Packages
Get:5 http://httpredir.debian.org jessie/main amd64 Packages [9064 kB]
Err http://httpredir.debian.org jessie-updates/main amd64 Packages
Err http://httpredir.debian.org jessie-updates/main amd64 Packages
404 Not Found [IP: 5.153.231.35 80]
Fetched 9808 kB in 15s (615 kB/s)
W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/Release.gpg Error reading from server. Remote end closed connection [IP: 5.153.231.35 80]
W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages 404 Not Found [IP: 5.153.231.35 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
The command '/bin/sh -c apt-get clean && apt-get update' returned a non-zero code: 100
Nothing changes, any idea?
I built your Dockerfile multiple times without issue. Try restarting your Docker service / instance / machine.
You may be having network issues, as the problem is intermittent.
Your Dockerfile works perfect from my machine. I guess it is caused by the network connectivity. So please check if you are behind a firewall, and whether you need to set a proxy in order to access the Internet. If so, please add this command into your Dockerfile in front of RUN apt-get commands to set proxy ENV http_proxy 'http://<server-address>:<port>'
This happend to me just due to the simple reason that my system clock was in past (not synced). fixing the time made this error disappear.

Resources