Building amd64 docker image in M1 machine throws errors - linux

I'm trying to build a amd64 docker image so that I can deploy it on ECS.
I used the command docker buildx build --platform linux/amd64 -t {image}:{version}, but it throws these errors:
> [ 3/13] RUN set -ex; apt-get update; apt-get install -y --no-install-recommends software-properties-common; add-apt-repository ppa:deadsnakes/ppa:
#0 0.225 + apt-get update
#0 42.18 Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease
#0 42.18 Connection failed [IP: 91.189.91.38 80]
#0 51.75 Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
#0 51.75 Connection failed [IP: 185.125.190.36 80]
#0 83.22 Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
#0 83.22 Connection failed [IP: 185.125.190.39 80]
#0 124.2 Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
#0 124.2 Connection failed [IP: 91.189.91.38 80]
#0 124.3 Reading package lists...
#0 124.4 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Connection failed [IP: 91.189.91.38 80]
#0 124.4 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Connection failed [IP: 185.125.190.39 80]
#0 124.4 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Connection failed [IP: 91.189.91.38 80]
#0 124.4 W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Connection failed [IP: 185.125.190.36 80]
#0 124.4 W: Some index files failed to download. They have been ignored, or old ones used instead.
#0 124.4 + apt-get install -y --no-install-recommends software-properties-common
#0 124.5 Reading package lists...
#0 124.6 Building dependency tree...
#0 124.6 Reading state information...
#0 124.6 Package software-properties-common is not available, but is referred to by another package.
#0 124.6 This may mean that the package is missing, has been obsoleted, or
#0 124.6 is only available from another source
#0 124.6
#0 124.6 E: Package 'software-properties-common' has no installation candidate
------
error: failed to solve: executor failed running [/bin/sh -c set -ex; apt-get update; apt-get install -y --no-install-recommends software-properties-common; add-apt-repository ppa:deadsnakes/ppa]: exit code: 100
If I switch platform to linux/arm64, building an image works correctly, but I get this error from AWS:
standard_init_linux.go:228: exec user process caused: exec format error
(I have #!/bin/bash inside of my script file and it has been worked fine before I used M1 mac.)
I'd appreciate your help. Thank you.

Related

Cannot build Docker images any more

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.

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.

Failed to download kernel source

Failed to download linux kernel source. What is wrong?
root#vagrant-ubuntu-trusty-64:/vagrant/pkgs# apt-get source linux-image-$(uname -r)
Reading package lists... Done
Building dependency tree
Reading state information... Done
Picking 'linux' as source package instead of 'linux-image-3.13.0-37-generic'
NOTICE: 'linux' packaging is maintained in the 'Git' version control system at:
http://kernel.ubuntu.com/git-repos/ubuntu/ubuntu-trusty.git
Need to get 125 MB of source archives.
Err http://archive.ubuntu.com/ubuntu/ trusty-updates/main linux 3.13.0-40.69 (dsc)
404 Not Found [IP: 91.189.88.149 80]
Get:1 http://archive.ubuntu.com/ubuntu/ trusty-updates/main linux 3.13.0-40.69 (tar) [116 MB]
Err http://archive.ubuntu.com/ubuntu/ trusty-updates/main linux 3.13.0-40.69 (diff)
404 Not Found [IP: 91.189.88.149 80]
Fetched 116 MB in 46s (2,494 kB/s)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/l/linux/linux_3.13.0-40.69.dsc 404 Not Found [IP: 91.189.88.149 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/l/linux/linux_3.13.0-40.69.diff.gz 404 Not Found [IP: 91.189.88.149 80]
E: Failed to fetch some archives.
I am using standard Ubuntu 14.04
root#vagrant-ubuntu-trusty-64:/vagrant/pkgs# more /etc/issue
Ubuntu 14.04.1 LTS \n \l
I believe that NOTICE: 'linux' packaging is maintained in the 'Git' version control system at:
http://kernel.ubuntu.com/git-repos/ubuntu/ubuntu-trusty.git is fairly straightforward. If you already have git installed use
git clone http://kernel.ubuntu.com/git-repos/ubuntu/ubuntu-trusty.git
Otherwise, install git first
sudo apt-get install git

Installing software in kubuntu [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have recently installed kubuntu. I am able to install softwares from muon software center. But when I try to do so from the terminal, I get errors. For instance on trying to update, I get:
Err http://archive.canonical.com quantal InRelease
Err http://archive.canonical.com quantal Release.gpg
Unable to connect to archive.canonical.com:http:
Err http://archive.ubuntu.com quantal InRelease
Err http://archive.ubuntu.com quantal Release.gpg
Unable to connect to archive.ubuntu.com:http: [IP: 91.189.92.201 80]
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/quantal/InRelease
W: Failed to fetch http://archive.canonical.com/dists/quantal/InRelease
W: Failed to fetch http://archive.canonical.com/dists/quantal/Release.gpg Unable to connect to archive.canonical.com:http:
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/quantal/Release.gpg Unable to connect to archive.ubuntu.com:http: [IP: 91.189.92.201 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.
Similarly when I try to install git-core, I get:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
git git-man liberror-perl
Suggested packages:
git-daemon-run git-daemon-sysvinit git-doc git-el git-arch git-cvs git-svn
git-email git-gui gitk gitweb
The following NEW packages will be installed:
git git-core git-man liberror-perl
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 6,704 kB of archives.
After this operation, 15.4 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Err http://archive.ubuntu.com/ubuntu/ quantal/main liberror-perl all 0.17-1
Could not connect to archive.ubuntu.com:80 (91.189.92.202). - connect (111: Connection refused) [IP: 91.189.92.202 80]
Err http://archive.ubuntu.com/ubuntu/ quantal/main git-man all 1:1.7.10.4-1ubuntu1
Unable to connect to archive.ubuntu.com:http: [IP: 91.189.92.202 80]
Err http://archive.ubuntu.com/ubuntu/ quantal/main git i386 1:1.7.10.4-1ubuntu1
Unable to connect to archive.ubuntu.com:http: [IP: 91.189.92.202 80]
Err http://archive.ubuntu.com/ubuntu/ quantal/main git-core all 1:1.7.10.4-1ubuntu1
Unable to connect to archive.ubuntu.com:http: [IP: 91.189.92.202 80]
Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libe/liberror-perl/liberror-perl_0.17-1_all.deb Could not connect to archive.ubuntu.com:80 (91.189.92.202). - connect (111: Connection refused) [IP: 91.189.92.202 80]
Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/g/git/git-man_1.7.10.4-1ubuntu1_all.deb Unable to connect to archive.ubuntu.com:http: [IP: 91.189.92.202 80]
Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/g/git/git_1.7.10.4-1ubuntu1_i386.deb Unable to connect to archive.ubuntu.com:http: [IP: 91.189.92.202 80]
Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/g/git/git-core_1.7.10.4-1ubuntu1_all.deb Unable to connect to archive.ubuntu.com:http: [IP: 91.189.92.202 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
How do I handle this. I am using internet behind a proxy server, if that matters.
You should add your proxy config to /etc/apt/apt.conf
Acquire::http::Proxy "http://proxy-ip-or-hostname:port";
eg:
Acquire::http::Proxy "http://192.168.0.1:3128";
or with authentication
Acquire::http::Proxy "http://user:pass#192.168.0.1:3128";

Failed installation of GD library on Debian

I am trying to install GD library on my Debian server, but the following error appears:
# apt-get install php5-gd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libapache2-mod-php5 libt1-5 php5-common php5-mcrypt php5-mysql
Suggested packages:
php-pear
The following NEW packages will be installed:
libt1-5 php5-gd
The following packages will be upgraded:
libapache2-mod-php5 php5-common php5-mcrypt php5-mysql
4 upgraded, 2 newly installed, 0 to remove and 39 not upgraded.
Need to get 3120kB of archives.
After this operation, 545kB of additional disk space will be used.
Do you want to continue [Y/n]? y
WARNING: The following packages cannot be authenticated!
php5-mysql php5-mcrypt libapache2-mod-php5 php5-common libt1-5 php5-gd
Install these packages without verification [y/N]? y
Err http://security.debian.org lenny/updates/main php5-mysql 5.2.6.dfsg.1-1+lenny16
404 Not Found [IP: 128.101.240.212 80]
Err http://security.debian.org lenny/updates/main php5-mcrypt 5.2.6.dfsg.1-1+lenny16
404 Not Found [IP: 128.101.240.212 80]
Err http://security.debian.org lenny/updates/main libapache2-mod-php5 5.2.6.dfsg.1-1+lenny16
404 Not Found [IP: 128.101.240.212 80]
Err http://security.debian.org lenny/updates/main php5-common 5.2.6.dfsg.1-1+lenny16
404 Not Found [IP: 128.101.240.212 80]
Err http://security.debian.org lenny/updates/main libt1-5 5.1.2-3+lenny1
404 Not Found [IP: 128.101.240.212 80]
Err http://security.debian.org lenny/updates/main php5-gd 5.2.6.dfsg.1-1+lenny16
404 Not Found [IP: 128.101.240.212 80]
Failed to fetch http://security.debian.org/pool/updates/main/p/php5/php5-mysql_5.2.6.dfsg.1-1+lenny16_i386.deb 404 Not Found [IP: 128.101.240.212 80]
Failed to fetch http://security.debian.org/pool/updates/main/p/php5/php5-mcrypt_5.2.6.dfsg.1-1+lenny16_i386.deb 404 Not Found [IP: 128.101.240.212 80]
Failed to fetch http://security.debian.org/pool/updates/main/p/php5/libapache2-mod-php5_5.2.6.dfsg.1-1+lenny16_i386.deb 404 Not Found [IP: 128.101.240.212 80]
Failed to fetch http://security.debian.org/pool/updates/main/p/php5/php5-common_5.2.6.dfsg.1-1+lenny16_i386.deb 404 Not Found [IP: 128.101.240.212 80]
Failed to fetch http://security.debian.org/pool/updates/main/t/t1lib/libt1-5_5.1.2-3+lenny1_i386.deb 404 Not Found [IP: 128.101.240.212 80]
Failed to fetch http://security.debian.org/pool/updates/main/p/php5/php5-gd_5.2.6.dfsg.1-1+lenny16_i386.deb 404 Not Found [IP: 128.101.240.212 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
I get a different IP for security.debian.org (195.20.242.89). Flush the DNS cache and try again, it's possible that they've moved IPs:
/etc/rc.d/init.d/nscd restart
And then follow the instructions and run
apt-get update
Before trying to install it again

Resources