编写了一个Dockerfile,主要目的是构建一个镜像,镜像默认安装了openjdk-1.8-jre,还有另外一些包(这些包里面有dev版本的,也有release版本的),Dockerfile的内容大致如下:

FROM ubuntu:16.04

RUN echo "deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse" > /etc/apt/sources.list \
&& echo "deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse" >> /etc/apt/sources.list \
&& echo "deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse" >> /etc/apt/sources.list \
&& echo "deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse" >> /etc/apt/sources.list \
&& echo "deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse" >> /etc/apt/sources.list \
&& apt-get update #安装openjdk--jre
RUN apt-get install -y openjdk--jre --fix-missing #安装其他使用的包
RUN apt-get install -y tar ubuntu-make autoconf automake build-essential libass-dev libfreetype6-dev \
libsdl1.-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev \
libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev libx264-dev libfdk-aac-dev yasm --fix-missing

这段Dockerfile build没有通过,在3台机器(分别对应不同的网络环境)上测试过,只有其中一个环境是能build成功,报错的两个环境都是以下错误(有差异的原因现在也没搞清楚,搞了两三个星期了,很晕)

Get: http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 libllvm3.8 amd64 1:3.8-2ubuntu4 [10.3 MB]
Err: http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 libllvm3.8 amd64 1:3.8-2ubuntu4
Hash Sum mismatch
...省略了中间一部分的日志... Unable to correct missing packages.
E: Failed to fetch http://mirrors.aliyun.com/ubuntu/pool/main/l/llvm-toolchain-3.8/libllvm3.8_3.8-2ubuntu4_amd64.deb Hash Sum mismatch E: Aborting install.
The command '/bin/sh -c apt-get install -y openjdk-8-jre --fix-missing' returned a non-zero code:

这个问题困扰了好长一段时间,之后尝试了一下只使用main的源,其他的删除掉,jre能安装成功,但是后面的那些包又找不到。所以最后只能使用以下的work around方案把镜像做成了:

FROM ubuntu:16.04

#openjdk--jre使用了updates源之后报hash sum mismatch的错误,
#只能使用main才能安装成功,这个问题没有找到根本原因,暂时使用此解决方式
RUN echo "deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse" > /etc/apt/sources.list \
&& apt-get update RUN apt-get install -y openjdk--jre --fix-missing RUN echo "deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse" > /etc/apt/sources.list \
&& echo "deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse" >> /etc/apt/sources.list \
&& echo "deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse" >> /etc/apt/sources.list \
&& echo "deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse" >> /etc/apt/sources.list \
&& echo "deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse" >> /etc/apt/sources.list \
&& apt-get update RUN apt-get install -y tar ubuntu-make autoconf automake build-essential libass-dev libfreetype6-dev \
libsdl1.-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev \
libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev libx264-dev libfdk-aac-dev yasm --fix-missing

源设置导致Docker镜像构建失败的更多相关文章

  1. Docker镜像构建(五)

    Docker 镜像介绍 Docker镜像构建分为两种,一种是手动构建,另一种是Dockerfile(自动构建) 手动构建docker镜像 案例:我们基于centos镜像进行构建,制作自己的nginx镜 ...

  2. 4、Docker 镜像构建

    Docker 镜像构建 构建分为两种 手动构建 自动构建dockerfile 手动构建 首先启动一个Centos 容器,然后在容器中安装一个nginx [root@node ~]# docker ru ...

  3. Docker镜像构建原理解析(不装docker也能构建镜像)

    在devops流程里面 构建镜像是一个非常重要的过程,一般构建镜像是写dockerfile文件然后通过docker client来构建的image. docker client 会先检查本地有没有im ...

  4. sqler sql 转rest api 的docker 镜像构建(续)使用源码编译

    sqler 在社区的响应还是很不错的,已经添加了好多数据库的连接,就在早上项目的包管理还没有写明确, 下午就已经有go mod 构建的支持了,同时也调整下docker 镜像的构建,直接使用git cl ...

  5. Spring Boot 2.6.0正式发布:默认禁止循环依赖、增强Docker镜像构建...

    昨天,Spring官方正式发布了Spring Boot今年最后一个特性版本:2.6.0 同时,也宣布了2.4.x版本的终结. 那么这个新版本又带来了哪些新特性呢?下面就一起跟着DD来看看吧! 重要特性 ...

  6. Docker镜像构建

    一.简介 在构建容器化应用时,相当重要的步骤莫过于镜像制作,本文将介绍镜像制作方法以及镜像制作的建议.通常镜像的制作有两种方式: 使用现有的容器使用docker commit 生成镜像 使用Docke ...

  7. apisix网关-构建docker镜像构建及插件化开发

    高能劝退:lua开发,适合小白看!!! 前段时间有个项目,用的java程序做网关,压测tps只有1k多点,惨不忍睹. 后来公司有个大佬改用apisix做网关,tps飙升到1w多. 于是对神奇的apis ...

  8. Docker镜像构建的两种方式

    关于Docker里面的几个主要概念 这里用个不太恰当的比方来说明. 大家肯定安装过ghost系统,镜像就像是ghost文件,容器就像是ghost系统.你可以拿别人的ghost文件安装系统(使用镜像运行 ...

  9. Docker镜像构建的两种方式(六)--技术流ken

    镜像构建介绍 在什么情况下我们需要自己构建镜像那? (1)当我们找不到现有的镜像,比如自己开发的应用程序 (2)需要在镜像中加入特定的功能 docker构建镜像有两种方式:docker commit命 ...

随机推荐

  1. Oracle 事务和异常处理

    Oracle 的异常和回滚 DECLARE dept_no ) :; BEGIN --开始事务 INSERT INTO dept VALUES (dept_no, '市场部', '北京'); --插入 ...

  2. HTML5-网页添加视频-菜鸟笔记

    一.标签 <video> 在html5中,有这么个标签 <video> 标签. <video> 允许你简单的嵌入一段视频. 二.浏览器的兼容性问题 WebM 容器通 ...

  3. Shiro Remember me设置

    1. 在Spring的相关配置文件中加入如下Remember me管理器配置: <!-- rememberMe管理器 --> <bean id="rememberMeMan ...

  4. cdnbest站点里设置防盗链

    设置需求只允许 test.kangleweb.com 访问  ,其他网站链接全部拒绝 (注:如果test.kangleweb.com是用https访问,那引用的内容地址www447.yivpn.cn也 ...

  5. 使用::befor和::after伪元素在网站中添加图标

    css3为了区分伪类和伪元素,伪元素采用双冒号写法. 常见伪类——:hover,:link,:active,:target,:not(),:focus. 常见伪元素——::first-letter,: ...

  6. EasyUI DataGrid设置列宽为百分比导致表头和内容错位的解决方法

    在DataGrid中设置列宽为百分比一般是没有问题的 columns: [[{ title: '内容', field: '__EMPTY', width: '40%' }, { title: '隐患级 ...

  7. includes() 方法

    字符串的includes()和数组中的includes()判断有没有括号里面的值,有的话为true,没有为false. 详细解析:https://blog.csdn.net/wu_xianqiang/ ...

  8. makefile中一些编译器选项

    Libraries Static Libraries a collection of ordinary object files (目标文件的集合) loaded at program link ti ...

  9. springboot中使用ContextLoaderListener.getCurrentWebApplicationContext();获取WebApplicationContext为空问题

    WebApplicationContext applicationContext = ContextLoaderListener.getCurrentWebApplicationContext(); ...

  10. JQuery复习心得

    this === event.currentTarget    event.stopPropagation  阻止冒泡  http:www.css88.com JQ和原生JS入口函数的区别: 书写个数 ...