Docker ubuntn using the apt-get update error

Performed docker container apt-get update will complain sometimes, of course, there are many cases causes an error, specific conditions,

APT Hash sum mismatch errors common solutions are summarized in this blog written in good, thank thinking bloggers provide.

The following are my solutions to address apt-get update error of docker container executed (step on a lot of pits, bloody Ah, finally easy to use.):

root@33c5b2ae7edc:/# apt-get update
Err:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu xenial-security InRelease
Temporary failure resolving 'security.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... Done
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.
<1> 首先配置docker容器的DNS

The cat /etc/resolv.conf command to view the vessel and the host's DNS settings, DNS settings, and a host of container should be consistent.

docker DNS setup parameters may be added when starting to set the container --dns 8.8.8.8 (present active)

Or be permanently set by the DNS parameters / etc / default / docker, and then restarted DOCKER force,

     export http_proxy="http://10.1.9.100:808/"
   DOCKER_OPTS="--dns 210.83.210.155 --dns 127.0.1.1"

 

sudo service docker restart

Is there apt.conf file <2> View the container / etc / apt / directory, the proxy configuration file:

:: HTTP :: Proxy Acquire "http://10.1.9.100:8080/";
Acquire :: :: the FTP Proxy "ftp://10.1.9.100:8080/";
Acquire :: :: HTTPS Proxy "HTTPS: //10.1.9.100:8080/ ";
if not the file, the file can be copied apt.conf the host machine to the corresponding container directory.

<3> The proxy server settings:

Some developers also problems encountered, because of the company's Proxy settings.
If readers use a Proxy, you can try to create a directory name in the /etc/apt/apt.conf.d/ container is the file 99fixbadproxy

$ Sudo gedit /etc/apt/apt.conf.d/99fixbadproxy
copy the following text into the above-mentioned document, then save and exit:

Acquire::http::Pipeline-Depth 0;
Acquire::http::No-Cache true;
Acquire::BrokenProxy true;
<4> 清cache缓存:

APT-GET Clean sudo $
$ sudo APT-GET-Missing Update --fix
<5> You can change the APT source, the Internet has a lot of domestic sources, you can change the way the search.

Guess you like

Origin www.cnblogs.com/surplus/p/11580707.html
Recommended