NFIQ-2를 실행하기 위해 Centos 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