Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker Could not resolve 'deb.debian.org'

I was trying to build a container in Docker for some experiments. Here is my Dockerfile.

FROM debian

RUN mkdir -p /var/run/sshd

RUN apt-get update
RUN apt-get install -y openssh-server

RUN apt-get install -y sudo

RUN echo AddressFamily inet >> /etc/ssh/sshd_config

ARG username=Rivers
ARG userpasswd=perfectXJ2017

RUN useradd -ms /bin/bash $username && (echo $username:$userpasswd | chpasswd)

RUN adduser $username sudo

CMD /usr/sbin/sshd -D

I tried to build my image with the command sudo docker build -t ics-image ..

But then I got some error messages and the whole process stopped. Here is the error messages.

Sending build context to Docker daemon  2.048kB
Step 1/11 : FROM debian
 ---> 8626492fecd3
Step 2/11 : RUN mkdir -p /var/run/sshd
 ---> Running in 1e1f2dbbe5ca
Removing intermediate container 1e1f2dbbe5ca
 ---> dd4bec2f81d4
Step 3/11 : RUN apt-get update
 ---> Running in 022301215bfb
Get:1 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
Get:2 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [450 kB]
Err:3 http://deb.debian.org/debian stretch InRelease
  Could not resolve 'deb.debian.org'
Err:4 http://deb.debian.org/debian stretch-updates InRelease
  Could not resolve 'deb.debian.org'
Fetched 544 kB in 20s (26.9 kB/s)
Reading package lists...
W: Failed to fetch http://deb.debian.org/debian/dists/stretch/InRelease  Could not resolve 'deb.debian.org'
W: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/InRelease  Could not resolve 'deb.debian.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Removing intermediate container 022301215bfb
 ---> 054d32710b62
Step 4/11 : RUN apt-get install -y openssh-server
 ---> Running in 802d2fa37b8d
Reading package lists...
Building dependency tree...
Reading state information...
Package openssh-server is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'openssh-server' has no installation candidate
The command '/bin/sh -c apt-get install -y openssh-server' returned a non-zero code: 100

I did all this on Ubuntu 18.04. I cannot understand why this happened and how to solve this problem. Can anyone help?

like image 752
Rivers Shall Avatar asked Jun 26 '18 02:06

Rivers Shall


People also ask

Is Deb debian org down?

Debian.org is UP and reachable by us.

Does Docker use Debian?

The docker service starts automatically on Debian based distributions. On RPM based distributions, such as CentOS, Fedora, RHEL or SLES, you need to start it manually using the appropriate systemctl or service command. As the message indicates, non-root users can't run Docker commands by default.

Is Docker limited to Linux based containers?

You can run both Linux and Windows programs and executables in Docker containers. The Docker platform runs natively on Linux (on x86-64, ARM and many other CPU architectures) and on Windows (x86-64). Docker Inc. builds products that let you build and run containers on Linux, Windows and macOS.


1 Answers

This doesn't address the underlying issue, but I had success adding --network=host to the docker build command, e.g sudo docker build --network=host -t ics-image .. In my case everything in /etc/resolve.conf was correct, but there was an issue with docker using the correct ip tables and this was a quick workaround. Again, not a solution, but may help with debugging the problem.

like image 82
wingr Avatar answered Sep 27 '22 16:09

wingr