docker镜像如下:
今天在运行的容器内使用 apt-get update 命令进行更新时,发下很多404错误。
Err http://archive.ubuntu.com wily-updates/restricted amd64 Packages
Not Found [IP: 91.189.88.152 ]
Err http://archive.ubuntu.com wily-updates/universe amd64 Packages
Not Found [IP: 91.189.88.152 ]
Err http://archive.ubuntu.com wily-security/main Sources
Not Found [IP: 91.189.88.152 ]
Err http://archive.ubuntu.com wily-security/restricted Sources
Not Found [IP: 91.189.88.152 ]
Err http://archive.ubuntu.com wily-security/universe Sources
Not Found [IP: 91.189.88.152 ]
Err http://archive.ubuntu.com wily-security/main amd64 Packages
Not Found [IP: 91.189.88.152 ]
Err http://archive.ubuntu.com wily-security/restricted amd64 Packages
Not Found [IP: 91.189.88.152 ]
Err http://archive.ubuntu.com wily-security/universe amd64 Packages
Not Found [IP: 91.189.88.152 ]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/wily/main/source/Sources 404 Not Found [IP: 91.189.88.152 80] W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/wily/restricted/source/Sources 404 Not Found [IP: 91.189.88.152 80] W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/wily/universe/source/Sources 404 Not Found [IP: 91.189.88.152 80] W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/wily/main/binary-amd64/Packages 404 Not Found [IP: 91.189.88.152 80] W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/wily/restricted/binary-amd64/Packages 404 Not Found [IP: 91.189.88.152 80] W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/wily/universe/binary-amd64/Packages 404 Not Found [IP: 91.189.88.152 80] W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/wily-updates/main/source/Sources 404 Not Found [IP: 91.189.88.152 80] W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/wily-updates/restricted/source/Sources 404 Not Found [IP: 91.189.88.152 80]
经查,每一个Ubuntu发布版本都有它的结束时间,通常,Ubuntu发布版本支持18个月,而LTS (Long Term Support)(长期支持)版本分别支持3年(服务器版)和5年(桌面版)。
当一个Ubuntu发布版本到达结束期后,它的库将不再能够访问,并且你也不会得到任何维护更新和安全补丁。当写这个的时候,我的15.10版本已经到了它的结束期了。
对于那些使用旧版本的Ubuntu的用户,这是一个过期库的归档。因此,Ubuntu过期后,我们必须把源切换到 old-releases.ubuntu.com。
下面的方法通过切换到旧版本的源来解决“404 Not Found”错误。
首先,使用旧版本的源来替换当前主源
$ sudo sed -i -r 's/([a-z]{2}\.)?archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
$ sudo sed -i -r 's/security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
现在,应该能够在旧版本的Ubuntu镜像系统上进行安装或者更新了
在完成操作之后,输入 exit命令来退出这个容器。
此时ID为5a76c9bb0d02的容器,是按我们的需求更改的容器。我们可以通过命令 docker commit来提交容器副本。
sudo docker commit -m="has update" -a="zpt" 5a76c9bb0d02 zpt/ubuntu:v2
各个参数说明:
-m:提交的描述信息
-a:指定镜像作者
5a76c9bb0d02:容器ID
runoob/ubuntu:v2:指定要创建的目标镜像名
接下来我们可以使用 docker images 命令来查看我们的新镜像 zpt/ubuntu:v2: