I installed docker on CentOS 8. CentOS doesn't Docker anymore. When I type docker build -t project . than I get this error message:
Err:1 http://deb.debian.org/debian testing InRelease
Temporary failure resolving 'deb.debian.org'
Err:2 http://http.debian.net/debian sid InRelease
Temporary failure resolving 'http.debian.net'
Reading package lists...
W: Failed to fetch http://deb.debian.org/debian/dists/testing/InRelease Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://http.debian.net/debian/dists/sid/InRelease Temporary failure resolving 'http.debian.net'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
E: The value 'testing' is invalid for APT::Default-Release as such a release is not available in the sources
The command '/bin/sh -c apt-get update && apt-get install -yq --no-install-recommends groff && rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100
I tried in /etc/resolv.conf nameserver 8.8.8.8
In fact, when you do docker build, docker internal will set up temp build container for you, so it still related to container's dns.
By default, docker will use dns locally defined in your /etc/resolv.conf file, but if not found, you may also have chance to override it.
You should create next file with the following contents to set DNS:
/etc/docker/daemon.json:
{
"dns": ["your_dns_ip"]
}
Finally, restart your docker to make it take effect. Detail refers to Fix Docker's networking DNS config.
Additionally, make sure you use a workable dns, also make sure 8.8.8.8 really could work in your country if you use this.
Related
I am using a customized version of Ubuntu18.04 and I have a docker container where I tried to install a .deb package for the usage of a FLIR camera. To do so I downloaded from this website the file spinnaker-2.5.0.80-Ubuntu18.04-arm64-pkg.tar.gz, as suggested for Ubuntu18.04.
I followed those instructions to install everything, which basically means the following commands:
apt-get install libusb-1.0-0
tar xvfz spinnaker-2.5.0.80-Ubuntu18.04-arm64-pkg.tar.gz
cd spinnaker-2.5.0.80-arm64
./install_spinnaker_arm.sh
During this process the first errors arose, which I could fix through the installation of iputils-ping and lsb-release inside the docker container:
apt install iputils-ping
apt install -y lsb-release
However, afterwards another error arose:
/var/lib/dpkg/tmp.ci/preinst: 28 /var/lib/dpkg/tmp.ci/preinst: errmsg: not found
dpkg: error processing archive libspinnaker_2.5.0.80_arm64.deb (--install):
new libspinnaker package pre-installation script subprocess returned error exit status 127
ping: zone2.flir.net: No address associated with hostname
Errors were encountered while processing:
libspinnaker_2.5.0.80_arm64.deb
I though it is a nework issue inside the container but I do have internet connection, which I checked through:
ping www.google.com
Does anybody has a suggestion why I am not able to install the spinnaker SDK inside my docker container? Or has an explanation for me, what "no address associated with hostname" means? I am thankfull for every hint in any direction. Maybe it is an issue because I moved my docker data folder to an external SD card?
I'm trying to install jenkins on Ubuntu14.04 following this site.
After executing the last step, the terminal shows this error:
Err https://pkg.jenkins.io/debian-stable/ binary/ jenkins 2.235.5
gnutls_handshake() failed: Handshake failed
E: Failed to fetch https://pkg.jenkins.io/debian-stable/binary/jenkins_2.235.5_all.deb gnutls_handshake() failed: Handshake failed
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
I tried to run sudo apt-get update --fix-missing (no errow shown after running this cmd) but it doesn't help.
I also tried to install by downloading jenkins.war but the jenkins service isn't enabled after installing.
Please show me how to fix this issue.
The issue seems to be upstream (I have hit the same snag this morning trying to update one of my jenkins installls).
You could use wget and dpkg to fetch and install the deb package:
wget https://pkg.jenkins.io/debian-stable/binary/jenkins_2.235.5_all.deb && sudo dpkg -i jenkins_2.235.5_all.deb
Which will get you Jenkins installed.
I have the following Dockerfile that uses the latest Ubuntu image pulled from dockerhub:
FROM ubuntu:latest
RUN apt-get update && apt-get install -y g++ llvm lcov
when I launch the docker build command, the following errors occur:
Err:2 http://archive.ubuntu.com/ubuntu bionic InRelease
At least one invalid signature was encountered.
Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
At least one invalid signature was encountered.
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...
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.
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.
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.
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.
I read here https://superuser.com/questions/1331936/how-can-i-get-past-a-repository-is-not-signed-message-when-attempting-to-upgr that you can pass this error using --allow-unauthenitcated or --allow-insecure-repositories but both seem to me workarounds that may compromize security of the container.
EDIT
Tried to pull ubuntu:18.04, ubuntu:19:04, ubuntu:19.10 same error with different distro name
Apparently my root partition was full (maybe I've tried too many times to download packages through apt), and running sudo apt clean solved the issue
In addition, the following commands should help clean up space:
docker system df # which can show disk usage and size of 'Build Cache'
docker image prune # add -f or --force to not prompt for confirmation
docker container prune # add -f or --force to not prompt for confirmation
Since Docker API v1.25+ ( released: Nov 18, 2019 )
Running the command below fixed the problem for me:
docker system prune --force
The --force flag stands for noninteractive prune.
Additionally, you may want to give a try to the prune volume commands:
docker volume prune --force
fixed by
docker image prune -f
looks like docker has a limit on maximum apt cache size on the host system
If you're using Docker Desktop, take care of the maximum disk image size you've specified in the settings. It can cause the issue if it gets full during the build (source).
For Raspbian, upgrade libseccomp manually on the host system by using:
curl http://ftp.us.debian.org/debian/pool/main/libs/libseccomp/libseccomp2_2.5.1-1_armhf.deb --output libseccomp2_2.5.1-1_armhf.deb
sudo dpkg -i libseccomp2_2.5.1-1_armhf.deb
This resolved my issue.
Original post is here.
As #Danila and #Andriy pointed out this issue can easily be fixed running:
docker image prune -f
docker container prune -f
but posting this answer, as running just one of them didn't work for me (on MacOS X) - running both however does.
This helps me:
docker volume prune
I had to run container with --security-opt seccomp:unconfined.
I had this problem on one of my two machines. Doing a ls -ld /tmp I got
drwxrwxrwt 3 root root 4096 May 15 20:46 /tmp
for the working one and
drwxr-xr-t 1 root root 4096 May 26 05:44 /tmp
for the failing one. After I did chmod 1777 /tmp, it worked!!
EDIT:
So, I dived a little deeper into this problem and realized there was something fundamentally wrong. I put my problems in another question and later found the answer that solved this myself: https://stackoverflow.com/a/62088961/7387935
The key point here is that on the machine that was working correctly I had aufs as storage driver and on the faulty one it was overlay2. After I changed that, all permissions were correct.
I tried again later and it worked.
From https://github.com/docker-library/php/issues/898#issuecomment-539234070:
That usually means the mirror is having issues (possibly partially out
of date; i.e. not completely synced from other mirrors) and often
clears itself up.
I added --network=host to the build command.
docker build --network=host -t REPOSITORY:TAG ./
this worked for me
docker system prune -af --volumes
and these other ones as well
docker image prune
docker container prune
docker builder prune
docker volume prune
This running docker system df and see if you need free space on one of your volumes
I'm using kubernetes-plugin and I have some issue to build docker images on top of K8S pod:
I'm creating POD with:
podTemplate(containers: [
containerTemplate(
name: 'docker-build',
image: 'docker',
command: 'cat',
ttyEnabled: true
)
],
volumes: [
hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock')
])
{
node(POD_LABEL) {
stage("Checkout") {
dir("${env.WORKSPACE}/code") {
script {
// Checkout - Works
}
}
}
stage ('Build docker images') {
container('docker-build') {
dir("${env.WORKSPACE}/code") {
sh """
./build-images
"""
}
}
}
}
}
But it fails on the docker build step:
Err:1 http://deb.debian.org/debian stretch InRelease
Temporary failure resolving 'deb.debian.org'
Err:2 http://security.debian.org/debian-security stretch/updates InRelease
Temporary failure resolving 'security.debian.org'
Err:3 http://deb.debian.org/debian stretch-updates InRelease
Temporary failure resolving 'deb.debian.org'
Reading package lists...
[91mW: Failed to fetch http://deb.debian.org/debian/dists/stretch/InRelease Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://security.debian.org/debian-security/dists/stretch/updates/InRelease Temporary failure resolving 'security.debian.org'
W: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/InRelease Temporary failure resolving 'deb.debian.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.
[0mReading package lists...
Building dependency tree...
Reading state information...
[91mE: Unable to locate package libpam-dev
E: Unable to locate package libpcap0.8-dev
E: Couldn't find any package by glob 'libpcap0.8-dev'
E: Couldn't find any package by regex 'libpcap0.8-dev'
E: Unable to locate package libpq5[0m[91m
E: Unable to locate package libtins-dev
E: Unable to locate package openjdk-8-jdk-headless
E: Unable to locate package python3
When accessing the POD with kubectl exec and trying to build, it fails on the same error:
docker build -t my_test .
When trying to build the same with --network=host it works:
docker build --network=host -t my_test .
I'm trying to understand why it requires --network=host in order to work.
BTW - when I'm in the Jenkins slave pod and I'm trying to download any packages or access to the internet it all works just fine, it happens only when I'm trying to build docker image and trying to download packages during this process.
I suspect that the docker build is failing because of some network misconfiguration or maybe docker network is getting a bad state during this docker build on top of docker ..
So far I have tried:
Create the pod with hostNetwork: true and it didn't help.
Create the pod with privileged: true and it didn't help.
Many other hacks to make the pod running on different network and it did't help as well.
Please assist.
The latest versions of the AWS EKS-optimized AMI disable the docker bridge network by default. To enable it, add the bootstrap_extra_args parameter to your worker group template. Source.
Till few days back the Dockerfile was working fine and when i tried to build it again today it is giving following error in the terminal. I tried with multiple docker base images but still giving the same error. Can any one help me with this? I dont think i missed out anything. If i had missed it should have given me the error earlier itself but why now?
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 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:4 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: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package software-properties-common
and my docker version is
Docker version 17.03.2-ce, build f5ec1e2
And here is my Dockerfile
FROM ubuntu:16.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && \
apt-get install -y software-properties-common && \
apt-add-repository ppa:webupd8team/java && \
apt-get update -y && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 && \
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && \
apt-get install -y oracle-java8-installer && \
apt-get install -y oracle-java8-unlimited-jce-policy && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/oracle-jdk8-installer
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
If your host is an Ubuntu VM, it could be an invalid /etc/resolve.conf. Look at the /etc/resolv.conf on the host Ubuntu VM. If it contains nameserver 127.0.1.1, that is wrong.
Run these commands on the host Ubuntu VM to fix it:
sudo vi /etc/NetworkManager/NetworkManager.conf
# Comment out the line `dns=dnsmasq` with a `#`
# restart the network manager service
sudo systemctl restart network-manager
cat /etc/resolv.conf
Now /etc/resolv.conf should have a valid value for nameserver, which will be copied by the docker containers.
Looks like you have a connection error in your RUN instruction.
Try doing the same commands in an Ubuntu Container.
docker run -it ubuntu bash
And then inside the container do your RUN command.
On my machine, your script does work.
Solution that worked for me was to
check my host machine /etc/resolv.conf - looking for nameserver x.x.x.x
copy the nameserver that was there into my host machine's /etc/docker/daemon.json
this may require you to sudo su in order cd /etc/docker
you may not have that file, so just created it: nano daemon.json
add the following:
{
"dns": ["x.x.x.x", "z.z.z.z", "8.8.8.8"]
}
x.x.x.x and z.z.z.z could be your nameservers
8.8.8.8 is google's, which you can try.
Need to restart the docker daemon - sudo service docker restart
Over time my nameserver (at my house) changed, so I have a few, or I have to add to this file every now and then. It could also change if you are using the internet in different places - so this is not always the best solution.
I just changed my VM players network setting. Changed Network Connection from bridged mode to NAT.
Now its working
In my case bridge network was disabled in daemon.json.
After fixing as below it worked.
root#pc:/etc/docker# cat daemon.json
{
"iptables": true,
"bridge": "docker0"
}
And dont forget to restart:
sudo service docker restart
Also I used following useful commands to investigate the issue:
# List networks (it should have 3 lines bridge, host, none)
docker network ls
# Check the logs, it will have docker log
journalctl -xe
# This one showed me at the end that bridge was missing iptables config like below
# WARNING: bridge-nf-call-iptables is disabled
# WARNING: bridge-nf-call-ip6tables is disabled
docker info
A simple method could be write the nslookup archive.ubuntu.com IP to the /etc/hosts, then restart docker.
Of course it needs your docker 's /etc/docker/daemon.json use host machine 's IP.
Overview
There are two parts to your question:
1. fixing temporary resolve messages
2. fixing the package management issues
Temporary resolve
It is likely that this issue is either:
1. temporary due to your Internet Service Provider not correctly forwarding internet naming (DNS) to either its or external DNS servers, or
2. due to a change in your network has similarly blocked this naming - for example, new router/modem, reconfiguring a switch with a new configuration.
Let's look at the possible DNS resolving issues.
First, temporarily add a known DNS server to your system.
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
Then run sudo apt update.
If this fixes your temporary resolving messages then either wait for 24 hours to see if your ISP fixes the issue for you (or just contact your ISP) - or you can permanently add a DNS server to your system:
echo "nameserver 8.8.8.8" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null
8.8.8.8 is Google's own DNS server.
source
Another example DNS server you could use is OpenDNS- for example:
echo "nameserver 208.67.222.222" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null
package-management issues
In addition to the temporary resolve issues - you have a few package management issues that need to be corrected.
Open a terminal and type:-
sudo nano /etc/apt/sources.list
and look if you are downloading from right source package.
OR
if you are behind proxy use -E.for example:-
sudo -E apt-get update