Dockerfile执行命令报错"The command '/bin/sh -c apt-get install -y git' returned a non-zero code: 100"解决

Dockerfile文件中编辑如下内容:

# An example Dockerfile for installing Git on Ubuntu
From ubuntu
MAINTAINER "urmsone"
RUN apt-get install -y git
ENTRYPOINT ["git"]

执行 docker build -t test .命令后报错,The command '/bin/sh -c apt-get install -y git' returned a non-zero code: 100

解决:

在install之前先update,即apt-get update && apt-get install -y xxx
修正后的Dockerfile文件如下:

# An example Dockerfile for installing Git on Ubuntu
From ubuntu
MAINTAINER "urmsone"
RUN apt-get update --fix-missing && apt-get install -y git
ENTRYPOINT ["git"]

猜你喜欢

转载自blog.csdn.net/Urms_handsomeyu/article/details/86767018