编写了一个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. leetcode581

    public class Solution { public int FindUnsortedSubarray(int[] nums) { , end = -, min = nums[n - ], m ...

  2. subString(index,end) 用法

    sb = sb.Substring(0, sb.Length - 1); 获取当前字符串的前一部分去掉最后一个字符

  3. GDI+_入门教程【一】

    GDI For VisualBasic6.0 [一]文件下载:GDI+ For VB6[一] 简单绘图实例演示百度网盘 1 '以下为作者[vIsiaswx]的教程 '(该教程发布的原地址已无法访问,此 ...

  4. mysql数据库中指定值在所有表中所有字段中的替换

    MySQL数据库: 指定值在数据库中所有表所有字段值的替换(存储过程): 1.写一个存储过程,查指定数据库中所有的表名: CREATE PROCEDURE init_replace(in orig_s ...

  5. prometheus 表达式

    avg_over_time(my_inprogress_requests{job="mhc"}[5m] offset 3m) 返回time=1550664637开始向前偏移3分钟之 ...

  6. day43 多表查询和pymysql

    复习 增删改查全语法 # 增 insert into db1.t1(字段2, 字段1, ..., 字段n)|省略 values (值2, 值1, ..., 值n)|(值1, 值2, ..., 值n)[ ...

  7. 解决find命令报错: paths must precede expression

    eg: find . -name *.c -or -name *.cpp 需要将模糊搜索词用引号括起来: find . -name "*.c" -or -name "*. ...

  8. effector - 必应词典

    effector - 必应词典 美[ɪ'fektə(r)]英[ɪ'fektə(r)] n.效应物 网络效应器:效果器:受动器 变形复数:effectors:

  9. python + Jquery,抓取西东网上的Java教程资源网址

    #!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2018-06-15 14:01:45 # @Author : Chenjun (320 ...

  10. 763. Partition Labels 相同字母出现在同一块中,且块数最多

    [抄题]: A string S of lowercase letters is given. We want to partition this string into as many parts ...