Docker build出现“The command ‘/bin/sh -c apt-get install -y vim‘ returned a non-zzero code: 100”解决方法

最近在学习docker时,发现使用ubuntu构建镜像时,如果有apt-get install命令,老是出现以下错误:The command ‘/bin/sh -c apt-get install -y vim’ returned a non-zzero code: 100
查了一下,发现很多人都说是使用ubuntu原始的源在apt-get install下载新包时,可能因为网络问题导致出现此报错。尝试了一下换源,果然成功解决了问题,下面附上解决方法。

解决方法

# 原始命令
RUN apt-get install -y vim


# 修改方法
RUN sed -i 's#http://archive.ubuntu.com/#http://mirrors.tuna.tsinghua.edu.cn/#' /etc/apt/sources.list;
RUN apt-get update && apt-get install -y vim
#或者这个都可以
RUN apt-get update --fix-missing && apt-get install -y vim --fix-missing

猜你喜欢

转载自blog.csdn.net/weixin_41693877/article/details/108504527
今日推荐