强制 Centos Docker 镜像使用欧洲镜像

强制 Centos Docker 镜像使用欧洲镜像

我正在尝试构建 Centos Docker 映像来运行 NFIQ-2。它具有上面列出的 docker 文件。

################################################################################
#
#   Builder environnement
#
################################################################################

FROM centos as builder
LABEL maintainer "[email protected]"
RUN sed -i 's/enabled=1/enabled=0/g' /etc/yum/pluginconf.d/fastestmirror.conf
ADD NFIQ2.tgz /

RUN yum update && \
    yum upgrade -y

RUN yum group install -y "Development Tools" && \
    yum install -y cmake

RUN cd /NFIQ2/libOpenCV && \
    cmake -D CMAKE_MAKE_PROGRAM=make /NFIQ2/OpenCV/

RUN make -C /NFIQ2/libOpenCV \
    opencv_core opencv_ts opencv_imgproc opencv_highgui opencv_flann \
    opencv_features2d opencv_calib3d opencv_ml opencv_video opencv_objdetect \
    opencv_contrib opencv_nonfree opencv_gpu opencv_photo opencv_stitching opencv_videostab

RUN make -C /NFIQ2/NFIQ2/

ENV LD_LIBRARY_PATH=/NFIQ2/biomdi/common/lib:/NFIQ2/biomdi/fingerminutia/lib:/NFIQ2/libOpenCV/lib

################################################################################
#
#   Running environnement
#
################################################################################

FROM centos

COPY --from=builder /NFIQ2/NFIQ2/bin/ /NFIQ2/NFIQ2/bin/
COPY --from=builder /NFIQ2/biomdi/common/lib/ /NFIQ2/biomdi/common/lib/
COPY --from=builder /NFIQ2/biomdi/fingerminutia/lib/ /NFIQ2/biomdi/fingerminutia/lib/
COPY --from=builder /NFIQ2/libOpenCV/lib/ /NFIQ2/libOpenCV/lib/

COPY --from=builder /NFIQ2/complianceTestSet/ /NFIQ2/complianceTestSet/

ENV LD_LIBRARY_PATH=/NFIQ2/libOpenCV/lib:/NFIQ2/biomdi/common/lib:/NFIQ2/biomdi/fingerminutia/lib

当我运行它时,我似乎无法在存储库中找到软件包:

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=container error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
The command '/bin/sh -c yum update &&     yum upgrade -y' returned a non-zero code: 1

该软件包的维护者说 yum 为我获取的存储库缺少文件,但我如何在 docker 镜像中选择其他存储库?

答案1

更改更新命令就可以只运行 yum update:

FROM centos as builder
LABEL maintainer "[email protected]"
RUN sed -i 's/enabled=1/enabled=0/g' /etc/yum/pluginconf.d/fastestmirror.conf
ADD NFIQ2.tgz /

#RUN yum update && \
#    yum upgrade -y
RUN  yum update

RUN yum group install -y "Development Tools" && \
    yum install -y cmake

RUN cd /NFIQ2/libOpenCV && \
    cmake -D CMAKE_MAKE_PROGRAM=make /NFIQ2/OpenCV/

RUN make -C /NFIQ2/libOpenCV \
    opencv_core opencv_ts opencv_imgproc opencv_highgui opencv_flann \
    opencv_features2d opencv_calib3d opencv_ml opencv_video opencv_objdetect \
    opencv_contrib opencv_nonfree opencv_gpu opencv_photo opencv_stitching opencv_videostab

RUN make -C /NFIQ2/NFIQ2/

ENV LD_LIBRARY_PATH=/NFIQ2/biomdi/common/lib:/NFIQ2/biomdi/fingerminutia/lib:/NFIQ2/libOpenCV/lib

################################################################################
#
#   Running environnement
#
################################################################################

FROM centos

COPY --from=builder /NFIQ2/NFIQ2/bin/ /NFIQ2/NFIQ2/bin/
COPY --from=builder /NFIQ2/biomdi/common/lib/ /NFIQ2/biomdi/common/lib/
COPY --from=builder /NFIQ2/biomdi/fingerminutia/lib/ /NFIQ2/biomdi/fingerminutia/lib/
COPY --from=builder /NFIQ2/libOpenCV/lib/ /NFIQ2/libOpenCV/lib/

#COPY --from=builder /NFIQ2/complianceTestSet/ /NFIQ2/complianceTestSet/

ENV LD_LIBRARY_PATH=/NFIQ2/libOpenCV/lib:/NFIQ2/biomdi/common/lib:/NFIQ2/biomdi/fingerminutia/lib

相关内容