安装git出错

最新发现:是因为Ubuntu镜像源出错,我在18.04上误用了16.04ali mirror

问题

使用docker镜像zjzstu/ubuntu:18.04,发现无法安装git

...
...
The following packages have unmet dependencies:
 git : Depends: liberror-perl but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

缺少一系列的git依赖,测试多次之后成功安装git

Dockerfile

FROM zjzstu/ubuntu:18.04
RUN apt-get update \
    && apt-get install -y --allow-downgrades openssh-client perl-base=5.22.1-9ubuntu0.6 perl-modules-5.22 libperl5.22 netbase rename perl liberror-perl git
CMD git version 

镜像

构建镜像

$ docker build --no-cache -t zjzstu/ubuntu:18.04-git .

运行容器,输出git版本号

$ docker run zjzstu/ubuntu:18.04-git 
git version 2.7.4

上传到Docker Hub