挂载一块硬盘打包,修改ubuntu apt sourcee.list然后apt-get update后报错packages

Docker build 无法执行 Dockerfile 中的 apt-get update - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
已注册用户请 &
Docker build 无法执行 Dockerfile 中的 apt-get update
09:59:56 +08:00 · 3684 次点击
按照文档步骤来的,执行该命令时报错。
试了在 Dockerfile 中加入 apt-get clean 和 sudo rm -vf /var/lib/apt/lists/*,只能减少几条 Get 报错,不能完全解决问题。
我猜测大概是 Ubuntu 的源的问题,不知道如何改 image 的源。
Docker 的设置中已添加过了 Daocloud 的加速器。
Dockerfile 文件
FROM docker/whalesay:latest
RUN apt-get -y update && apt-get install -y fortunes
CMD /usr/games/fortune -a | cowsay
命令执行过程
$ docker build -t docker-whale .
Sending build context to Docker daemon 2.048 kB
Step 1/3 : FROM docker/whalesay:latest
---& 6b362a9f73eb
Step 2/3 : RUN apt-get -y update && apt-get install -y fortunes
---& Running in c4bed37eb3f2
Ign http://archive.ubuntu.com trusty InRelease
Get:1 http://archive.ubuntu.com trusty-updates InRelease [65.9 kB]
Get:2 http://archive.ubuntu.com trusty-security InRelease [65.9 kB]
Hit http://archive.ubuntu.com trusty Release.gpg
Get:3 http://archive.ubuntu.com trusty-updates/main Sources [1103 kB]
Hit http://archive.ubuntu.com trusty Release
Get:4 http://archive.ubuntu.com trusty-updates/universe Sources [220 kB]
Get:5 http://archive.ubuntu.com trusty-updates/main amd64 Packages [1197 kB]
Get:6 http://archive.ubuntu.com trusty-updates/restricted Sources [1103 kB]
Get:7 http://archive.ubuntu.com trusty-updates/restricted amd64 Packages [1197 kB]
Get:8 http://archive.ubuntu.com trusty-security/restricted Sources [1103 kB]
Get:9 http://archive.ubuntu.com trusty-security/restricted amd64 Packages [17.0 kB]
Get:10 http://archive.ubuntu.com trusty-updates/universe amd64 Packages [1197 kB]
Get:11 http://archive.ubuntu.com trusty-security/main Sources [2815 B]
Get:12 http://archive.ubuntu.com trusty-security/universe Sources [2815 B]
Get:13 http://archive.ubuntu.com trusty-security/main amd64 Packages [1197 kB]
Hit http://archive.ubuntu.com trusty/restricted Sources
Get:14 http://archive.ubuntu.com trusty-security/universe amd64 Packages [1197 kB]
Get:15 http://archive.ubuntu.com trusty/universe Sources [220 kB]
Get:16 http://archive.ubuntu.com trusty/main Sources [2815 B]
Get:17 http://archive.ubuntu.com trusty/main amd64 Packages [14.8 kB]
Hit http://archive.ubuntu.com trusty/restricted amd64 Packages
Get:18 http://archive.ubuntu.com trusty/universe amd64 Packages [17.0 kB]
Fetched 9920 kB in 17s (580 kB/s)
W: Size of file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_trusty_main_source_Sources.gz is not what the server reported
W: Size of file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_trusty_universe_source_Sources.gz is not what the server reported 5687
W: Size of file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_trusty_main_binary-amd64_Packages.gz is not what the server reported 9
W: Size of file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_trusty_universe_binary-amd64_Packages.gz is not what the server reported 5
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/source/Sources
Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/restricted/source/Sources
Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/universe/source/Sources
Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/binary-amd64/Packages
Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/restricted/binary-amd64/Packages
Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/universe/binary-amd64/Packages
Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/main/source/Sources
Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/restricted/source/Sources
Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/universe/source/Sources
Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/main/binary-amd64/Packages
Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/universe/binary-amd64/Packages
Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/main/source/Sources
Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/universe/source/Sources
Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/main/binary-amd64/Packages
Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/universe/binary-amd64/Packages
Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead.
The command '/bin/sh -c apt-get -y update && apt-get install -y fortunes' returned a non-zero code: 100
8 回复 &| &直到
11:26:33 +08:00
& & 10:13:49 +08:00
建议你好好看下 log ,然后去 Google 搜索: “ Hash Sum mismatch ” “ apt-get ”
& & 10:28:45 +08:00
要翻墙吧,或者用 DockerHub 镜像加速
& & 10:40:11 +08:00
FROM docker/whalesay:latest
RUN 换国内源
RUN apt-get -y update && apt-get install -y fortunes
CMD /usr/games/fortune -a | cowsay
& & 11:15:24 +08:00
@ 搜过的来着,顺着 stackoverflow 一条一条试,在 apt-get update 前加 apt-get clean 等,试过没有效果。在 /etc/apt/sources.list 中加入 deb 命令那些,不知道怎么找到镜像的文件位置,自己的系统是没有这个 /etc/apt/的目录···
& & 11:17:25 +08:00
@ 找到一条这个命令
RUN sed -i 's/http:\/\/archive\.ubuntu\.com\/ubuntu\//http:\/\/mirrors\.163\.com\/ubuntu\//g' /etc/apt/sources.list
解决了
3q
还不太懂这个语句
& & 11:18:32 +08:00
@ 翻墙一直开着的,镜像加速用了,对下载
的有用,这里依然不行
& & 11:22:01 +08:00
解决 apt-get update 慢的问题,你可以试试这个: RUN sudo sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
& & 11:26:33 +08:00
首先,你需要知道 apt-get update 在干什么
其次,你需要知道 &Hash Sum mismatch& 意味着什么:

更新 package 信息失败(被墙干扰) =& 所以,你需要使用国内的 repo
然后,你需要知道 sed -i '******' /path/to/file 命令在干什么:

另外,你在主机开翻墙,很可能对 Docker 是无效的。
如果你要让 Docker 翻墙,你可以 Google socks5 docker
& · & 2579 人在线 & 最高记录 3541 & · &
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.1 · 15ms · UTC 05:11 · PVG 13:11 · LAX 22:11 · JFK 01:11? Do have faith in what you're doing.ubuntu sudo apt-get update 失败
Entropy_lxl
sudo apt-get update
报了一堆错误:
Err http://cn.archive.ubuntu.com trusty InRelease
Err http://cn.archive.ubuntu.com trusty-updates InRelease
Err http://cn.archive.ubuntu.com trusty-backports InRelease
Err http://cn.archive.ubuntu.com trusty Release.gpg
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/trusty/InRelease
错误显示了源有问题,好像是被墙了。
查找解决办法,修改/etc/apt/source.list文件。将源改成163的或者阿里的:
deb http://mirrors.163.com/ubuntu/ vivid main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ vivid-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ vivid-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ vivid-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ vivid-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ vivid main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ vivid-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ vivid-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ vivid-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ vivid-backports main restricted universe multiverse
但是source.list文件是只读的,修改不了。
要使用sudo gedit&/etc/apt/source.list修改,但是gedit 指令没有装,使用sudo apt-get install gedit又安装不了。
解决办法:(修改DNS)
sudo vi /etc/resolvconf/resolv.conf.d/base
在里面插入:nameserver&8.8.8.8nameserver&8.8.4.4
修改好保存!wq,
sudo resolvconf -u
再看/etc/resolv.conf,最下面就多了2行:
cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 8.8.8.8
nameserver 8.8.4.4
sudo apt-get update
可以运行,然后就可以使用sudo apt-get install **指令了。
ubuntu apt-get update失败 1.出现错误:E:Could not get lock /var/lib/apt/lists/lock - open (11: Resource tem ...
Win10 连接L2TP VPN 失败解决方法 iOS系统不知道在什么时候,已经不支持PPTP VPN.偶尔的机会刚好看到github上的一键式VPN服务器部署脚本setup-ipsec-vpn,就在 ...
update error 解决方法
本来真不想写这篇博文的,但是eclipse和maven真的是太操蛋了,动不动就出了一些乱七八糟的问题,记录一下.希望公司能早 ...
用户 NT AUTHORITY\NETWORK SERVICE 登录失败 解决方法 (MS SQL 2005) Windows server
Web.Config 配置连接sql
检索 COM 类工厂中 CLSID 为 {0-11CF-AE68-00AA004A34D5} 的组件时失败,解决方法如下: 第 一步:首先将msvcr71.dll,
转:http://www.cnblogs.com/JasonLiao/archive//1630895.html Oracle中的 UPDATE FROM 解决方法 在表的更新操作 ...
nfs文件系统挂载失败解决方法 */--& nfs文件系统挂载失败解决方法 Table of Contents 1. 错误提示 2. 我的配置 1 错误提示 bootserver=255.255 ...
从Oracle高版本中导出dmp,然后导入到Oracle低版本时会报错:&不是有效的导出文件.头部验证失败&,解决方法: 方法一:下载软件:AlxcTools,打开后选择要修改的文 ...
“获取AutoCAD安装信息时失败...”解决方法:在“setup.exe”上右键,以管理员权限运行即可.
作为一个工作一年的菜鸟,在公司做了几个外包项目,也接触到了不同形式的web开发.其实也没多少,就是javaweb开发和HTML5移动开发,这两者在页面展示的时候的解决方案还是有所不同的. 1.vo+e ...
今天打开VS2008的智能设备项目,报以下错误,应该是文件找不到了. The imported project &C:\WINDOWS\Microsoft.NET\Framework\v3. ...
1.如果图片头信息有 &Content-Disposition&, & filename=&fileName& 那么直接使用 i ...
&1& 利用多线程的方法:[NSThread sleepForTimeInterval:300];
bootstrap组件需要引入bootstrap.js才行,当然要引入bootstrap.js首先得引入JQuery. 一.下拉菜单 将下拉菜单触发器和下拉菜单都包裹在 .dropdown 里,或者另 ...
1.Error (10028): Can't resolve multiple constant drivers for net ** 这种错误一般是由于定义的reg寄存器在多个always中进行赋值 ...
分析: 考察二分,简单模拟会超时,优化后时间正好,但二分速度快些,注意以下几点: (1):如果一个序列D1 ... Dn,如果我们计算Di到Dj的和, 那么我们可以计算D1到Dj的和sum1,D1到D ...
两个现实中的例子:1.B超:大家体检的时候大概都做过B超吧,B超可以透过肚皮探测到你内脏的生理情况.这是如何做到的呢?B超是B型超声波,它可以透过肚皮通过向你体内发射B型超声波,当超声波遇到内脏壁的时 ...
atitit 提升数据库死锁处理总结 正常的来说,锁上都是自动的..不用官.. 正常来讲,insert时不需要加rowlock,就默认是rowlock了, #-----锁的自动转换原理.(正常的不用理 ...
一.实验目标 编写Mapreduce程序,以Hbase表数据为Map输入源,计算结果输出到HDFS或者Hbase表中. 在非CDH5的Hadoop集群环境中,将编写好的Mapreduce程序整个工程打 ...ubuntu更新源时到最后有一个源提示无法下载_百度知道
ubuntu更新源时到最后有一个源提示无法下载
前一段时间为了使用wps,(我的系统是14.04,而且是64位操作系统,死活无法使用wps啊),我在网上用了很多教程,其中添加了好几个源,但明显有一个源是错误的。于是update时,到了最后就出现以下情况,我想既然无法下载干脆就删除得了,可我不知道怎么删,
我有更好的答案
把/etc/apt/sources.list文件中的地址换成下面后再执行sudo apt-get update deb
lucid main restricted universe multiversedeb / lucid-security main restricted universe multiversedeb / lucid-updates main restricted universe multiversedeb / lucid-proposed main restricted universe multiversedeb / lucid-backports main restricted universe multiversedeb-src / lucid main restricted universe multiversedeb-src / lucid-security main restricted universe multiversedeb-src / lucid-updates main restricted universe multiversedeb-src / lucid-proposed main restricted universe multiversedeb-src / lucid-backports main restricted universe multiverse 这种错误都是源的问题推荐使用deepin,不用这么折腾
采纳率:82%
来自团队:
装wps的话添加ia32包就行了……去 /etc/apt/source.list 和 /etc/apt/source.d/ 里看一下另外你这Trusty(14.04)乱加什么Raring(13.04)的源
好吧,问题是怎么删除,我打开了一个关于源的文件,但是不知道该删除什么东西。
把和报错有关的行全删了呀而且你又不把文件贴出来,我怎么跟你详细讲删什么……
本回答被网友采纳
为您推荐:
其他类似问题
ubuntu的相关知识
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。胖爷,4年后见! --- 日
Ubuntu 解决:当执行`sudo apt-get update`命令时 出现的
“apt-get 404 Not Found Package Repository Errors” 问题
当你执行sudo apt-get update命令的时候,如果你遇到下面的问题:
W: The repository 'http://ppa.launchpad.net/ackondro/tibesti/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://ppa.launchpad.net/ackondro/tibesti/ubuntu/dists/xenial/main/binary-amd64/Packages
E: Some index files failed to download. They have been ignored, or old ones used instead.
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
W: The repository 'http://ppa.launchpad.net/ackondro/tibesti/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://ppa.launchpad.net/ackondro/tibesti/ubuntu/dists/xenial/main/binary-amd64/Packages
E: Some index files failed to download. They have been ignored, or old ones used instead.
首先,我们将现在出问题的 /etc/apt/sources.list 文件备份一份。(只是一个好习惯而已)
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
注: /etc/apt/sources.list 文件 里面存放的是
Linux系统需要的软件源的网站。
接着,我们重新编写一个 /etc/apt/sources.list 文件:
sudo gedit /etc/apt/sources.list
将下面的模板内容,复制粘贴到 /etc/apt/sources.list 文件里面后,保存就可以了:(我们使用的Ubuntu 是16.04)
deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
##测试版源
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
##测试版源
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-proposed main restricted universe multiverse
如要用于其他版本,把 xenial 换成版本代号就好:
xenial()
trusty()
precise()
现在,再执行:
sudo apt-get update
现在就没有“apt-get 404 Not Found Package Repository Errors” 问题了。
这个问题,解决方法简单,但是对于初学者来说,却是一个触手的问题。
出现这个问题的原因是: 之前 /etc/apt/sources.list 路径里面的软件源更新网站有的已经过时了,需要更新新的网站。
Unable to connect to cn.archive.ubuntu.com:http: [112.124.140.210 80]
如果你出现这样的错误,说明你的网断了,查看网络连接情况。
参考网站:
How to fix Ubuntu/Debian apt-get 404 Not Found Package Repository Errors (Saucy, Raring, Quantal, Oneiric, Natty…)
Ubuntu apt-get unable to fetch packages
没有更多推荐了,
加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!解决Ubuntu下apt-get update无法添加新的CD-ROM的问题
开源中文社区 & 发布时间: 18:00:08 & 作者:Abhishek
这篇文章主要介绍了解决Ubuntu下apt-get update无法添加新的CD-ROM的问题,主要是从软件源中移除cdrom的操作,需要的朋友可以参考下
这些天我正在体验Elementary OS Freya,在这期间,我遇到了一个非常常见的更新错误:Failed to fetch cdrom Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs。完整的错误在运行apt-get update后看上去像这样:
&&&代码如下:W: Failed to fetch cdrom://elementary OS 0.3 Freya & Daily amd64 ()/dists/trusty/main/binary-amd64/Packages Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs&/p&
W: Failed to fetch cdrom://elementary OS 0.3 Freya & Daily amd64 ()/dists/trusty/restricted/binary-amd64/Packages Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs&/p&
E: Some index files failed to download. They have been ignored, or old ones used instead.
本篇中,我们会了解如何修复这个错误。修复apt-get update无法添加新的CD-ROM的错误
这个错误的原因是cdrom已经被包含在源之中。要修复这个问题,我们需要将它从软件源中移除。
在Ubuntu中,找到&软件与更新&:
在Ubuntu Software的第一个标签中,找到cdrom,如果它是勾选的,那么取消勾选。
关闭软件源并再次运行更新。现在应该可以用了。进一步故障排除:
上面描述的方法已经修复了这个apt-get update cannot be used to add new CD-ROMs错误。但是这个方法对我无效,因为cdrom的选项这时是灰色的,因为我使用的live版本。
现在要修复我们的问题了,我们是要采用命令行路线。打开终端并查看软件源中包含了哪些源:
代码如下:cat /etc/apt/sources.list
我的输出是下面这样:
&&&代码如下:deb cdrom:[elementary OS 0.3 _Freya_ & Daily amd64 ()]/ trusty main restricted
deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
在上面的第一行中。它包含了cdrom。我们需要用&#&来注释掉这行:
&&&代码如下:#deb cdrom:[elementary OS 0.3 _Freya_ & Daily amd64 ()]/ trusty main restricted
要用下面的命令来:
&&&代码如下:sudo gedit /etc/apt/sources.list
在你编辑完软件源后,再次运行apt-get update。&apt-get update cannot be used to add new CD-ROMs&这个错误应该已经修复了。如果你还遇到其他的问题,看一下这篇收集了大部分的文章。
大家感兴趣的内容
12345678910
最近更新的内容}

我要回帖

更多关于 ubuntu apt source 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信