![](/img/trans.png)
[英]Download failure within official ubuntu docker images on Ubuntu 14.04 host
[英]Docker images Ubuntu 14.04 not connected internet
我已經使用dockerfile在鏡像docker上安裝了ubuntu 14:04
在我的dockerfile中,需要在ubuntu中更新和安裝應用程序
在dockerfile上,我填充如下語法
# get Ubuntu 14.04 images
FROM ubuntu:14.04
# copy file on local to images
COPY erp-enterprise_revisi.tar.gz /home/
# Update repository
RUN apt-get update
# Install mc on Ubuntu 14.04
RUN apt-get install mc
但是這個錯誤
Sending build context to Docker daemon 1.236 GB
Step 1 : FROM ubuntu:14.04
---> e9ae3c220b23
Step 2 : COPY erp-enterprise_revisi.tar.gz /home/
---> d94e66b9d23f
Removing intermediate container babeb959ae8e
Step 3 : RUN apt-get update
---> Running in ac702e7d10f4
Err http://archive.ubuntu.com trusty InRelease
Err http://archive.ubuntu.com trusty-updates InRelease
Err http://archive.ubuntu.com trusty-security InRelease
Err http://archive.ubuntu.com trusty Release.gpg
Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com trusty-updates Release.gpg
Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com trusty-security Release.gpg
Could not resolve 'archive.ubuntu.com'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/InRelease
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/InRelease
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/InRelease
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/Release.gpg Could not resolve 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/Release.gpg Could not resolve 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/Release.gpg Could not resolve 'archive.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
---> 2093977bf1d3
Removing intermediate container ac702e7d10f4
Step 4 : RUN apt-get install mc
---> Running in c38aa81084f4
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package mc
The command '/bin/sh -c apt-get install mc' returned a non-zero code: 100
如何連接到互聯網?
在第3層環境中RUN apt-get update
( RUN apt-get update
)時,會出現一些網絡錯誤。
當僅在第4層上編輯Dockerfile時,docker docker build
使用了緩存的層,而第1層至第3層則不再構建。
您需要使用-no-cache
重新構建
因此,請嘗試以下操作:
$ cat Dockerfile
# get Ubuntu 14.04 images
FROM ubuntu:14.04
# copy file on local to images
#COPY erp-enterprise_revisi.tar.gz /home/
# Update repository
RUN apt-get update
# Install mc on Ubuntu 14.04
RUN apt-get install -y mc <== Here you need give -y to force the install
$ docker build -no-cache -t test .
剛剛找到這篇文章,所以您應該在安裝mc之前更改存儲庫, http://slick.pl/kb/linux/installing-midnight-commander-4-8-11-ubuntu-14-04-13-10-13 -04-12-04 /
在您的DockerFile中,將RUN apt-get install mc
替換為RUN apt-get -y install mc
,強制回答yes
以避免非零代碼錯誤
並不是說它可能適用於這種特殊情況,... ;-)
...但是您會遇到類似的症狀(例如,容器無法連接到外部環境-例如,解析dns名稱,導致出現諸如“無法解析'archive.ubuntu.com'“ ),而docker守護進程未啟用沒有使用/應用所需的防火牆規則。 例如,使用選項'--iptables = false'或類似選項啟動時。
始終值得從容器內部運行ping xxxx(類似於google dns 8.8.8.8)以查看是否可以訪問。 如果它不是從容器內部而是從Docker主機運行,則可能存在防火牆設置問題
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.