用history命令看看镜像内容,详情如下,合计五百多兆,已经不小了:
CN0014009475M:~ will$ docker history bolingcavalry/centos7.6-jdk8:0.0.1 IMAGE CREATED CREATED BY SIZE COMMENT a5dead4a6505 2 days ago /bin/sh -c set -eux; arch="$(objdump… 209MB <missing> 2 days ago /bin/sh -c #(nop) ENV LANG=C.UTF-8 0B <missing> 2 days ago /bin/sh -c #(nop) ENV PATH=http://www.likecs.com/usr/java/openjd… 0B <missing> 2 days ago /bin/sh -c #(nop) ENV JAVA_HOME=http://www.likecs.com/usr/java/o… 0B <missing> 2 days ago /bin/sh -c set -eux; yum install -y … 144MB <missing> 2 years ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0B <missing> 2 years ago /bin/sh -c #(nop) LABEL org.label-schema.sc… 0B <missing> 2 years ago /bin/sh -c #(nop) ADD file:54b004357379717df… 202MB我这里已经推送到hub.docker.com上去了,执行以下命令即可下载到本地:
docker pull bolingcavalry/centos7.6-jdk8:0.0.3 CentOS+JDK+OpenCV镜像接下来可以集成OpenCV了,Dockerfile内容如下所示,基础镜像是刚刚做好的bolingcavalry/centos7.6-jdk8:0.0.1,先是安装一大堆编译所需的应用,然后下载OpenCV-3.4.3版本的源码,然后编译,就这么简单(但其间的调试工作还是不少的,不说了,说多了都是泪):
FROM bolingcavalry/centos7.6-jdk8:0.0.1 RUN echo "export LC_ALL=en_US.UTF-8" >> /etc/profile \ && source /etc/profile RUN set -eux; \ yum install -y \ make \ cmake \ gcc \ gcc-c++ \ gtk+-devel \ gimp-devel \ gimp-devel-tools \ gimp-help-browser \ zlib-devel \ libtiff-devel \ libjpeg-devel \ libpng-devel \ gstreamer-devel \ libavc1394-devel \ libraw1394-devel \ libdc1394-devel \ jasper-devel \ jasper-utils \ swig \ python \ libtool \ nasm \ build-essential \ ant \ unzip \ ; RUN set -eux; \ curl -fL -o opencv-3.4.3.zip https://codeload.github.com/opencv/opencv/zip/3.4.3; \ unzip opencv-3.4.3.zip; \ rm -rf opencv-3.4.3.zip; \ cd opencv-3.4.3; \ mkdir build; \ cd build; \ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=http://www.likecs.com/usr/local ..; \ make; \ make install; \ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=http://www.likecs.com/usr/local -DBUILD_TESTS=OFF ..;\ make -j8; \ make install写完之后执行docker build -t bolingcavalry/opencv3.4.3:0.0.3 .即可生成镜像,如果您有hub.docker.com的账号,还可以将其推送到中央仓库,给更多人使用
用history命令看看镜像内容,详情如下,倒吸一口凉气,这么大的体积,亲爱的读者们会不会打死我...:
CN0014009475M:~ will$ docker history bolingcavalry/opencv3.4.3:0.0.3 IMAGE CREATED CREATED BY SIZE COMMENT f0306d7a2594 2 days ago /bin/sh -c set -eux; curl -fL -o opencv-… 2.99GB <missing> 2 days ago /bin/sh -c set -eux; yum install -y … 638MB <missing> 2 days ago /bin/sh -c echo "export LC_ALL=en_US.UTF-8" … 1.84kB <missing> 2 days ago /bin/sh -c set -eux; arch="$(objdump… 209MB <missing> 2 days ago /bin/sh -c #(nop) ENV LANG=C.UTF-8 0B <missing> 2 days ago /bin/sh -c #(nop) ENV PATH=http://www.likecs.com/usr/java/openjd… 0B <missing> 2 days ago /bin/sh -c #(nop) ENV JAVA_HOME=http://www.likecs.com/usr/java/o… 0B <missing> 2 days ago /bin/sh -c set -eux; yum install -y … 144MB <missing> 2 years ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0B <missing> 2 years ago /bin/sh -c #(nop) LABEL org.label-schema.sc… 0B <missing> 2 years ago /bin/sh -c #(nop) ADD file:54b004357379717df… 202MB我这里已经推送到hub.docker.com上去了,执行以下命令即可下载到本地:
docker pull bolingcavalry/opencv3.4.3:0.0.3这里要提醒一下,opencv的编译是非常耗时的,请确保docker宿主机的性能不要太差,也请您耐心等待编译过程