对应从事遥感与地理信息的同仁来说,gdal应该是所有工具中使用频度最高的库了,那么在docker中使用gdal时,面临的第一步就是构建gdal基础镜像,社区中引用最多的就是geodata提供的gdal基础镜像包,封装的gdal最新版本是2.3.0dev。

geodata/gdal的docker在github上的地址如下:

https://github.com/geo-data/gdal-docker

根据该库的提交记录,其生成gdal镜像的方法经历了多次更新:

1 最初按照gdal官网步骤自行编译;

2 基于makefile采用make系统编译;

3 基于gdal的travel ci 脚本进行编译。

dockerfile内容如下:

##
# geodata/gdal
#
# This creates an Ubuntu derived base image that installs the latest GDAL
# subversion checkout compiled with a broad range of drivers. The build process
# is based on that defined in
# <https://github.com/OSGeo/gdal/blob/trunk/.travis.yml>
# # Ubuntu 14.04 Trusty Tahyr
FROM ubuntu:trusty MAINTAINER Homme Zwaagstra <hrz@geodata.soton.ac.uk> # Install the application.
ADD . /usr/local/src/gdal-docker/
RUN /usr/local/src/gdal-docker/build.sh # Externally accessible data is by default put in /data
WORKDIR /data
VOLUME ["/data"] # Output version and capabilities by default.
CMD gdalinfo --version && gdalinfo --formats && ogrinfo --formats

基于ubuntu:trusty基础镜像,复制镜像构建相关内容到镜像的/usr/local/src/gdal-docker目录,利用build.sh脚本执行构建操作。

build.sh内容如下:

#!/bin/sh

##
# Install GDAL from within a docker container
#
# This script is designed to be run from within a docker container in order to
# install GDAL. It delegates to `before_install.sh` and `install.sh` which are
# patched from the Travis CI configuration in the GDAL repository.
# set -e DIR=$(dirname "$(readlink -f "$")")
GDAL_VERSION=$(cat ${DIR}/gdal-checkout.txt) export DEBIAN_FRONTEND=noninteractive # Set the locale. Required for subversion to work on the repository.
update-locale LANG="C.UTF-8"
dpkg-reconfigure locales
. /etc/default/locale
export LANG # Instell prerequisites.
apt-get update -y
apt-get install -y \
software-properties-common \
wget \
unzip \
subversion \
ccache \
clang-3.5 \
patch \
python-dev \
ant # Everything happens under here.
cd /tmp # Get GDAL.
svn checkout --quiet "http://svn.osgeo.org/gdal/${GDAL_VERSION}/" /tmp/gdal/ # Install GDAL.
cd /tmp/gdal # Apply our build patches.
patch ./gdal/ci/travis/trusty_clang/before_install.sh ${DIR}/before_install.sh.patch
patch ./gdal/ci/travis/trusty_clang/install.sh ${DIR}/install.sh.patch # Do the build.
. ./gdal/ci/travis/trusty_clang/before_install.sh
. ./gdal/ci/travis/trusty_clang/install.sh # Clean up.
apt-get autoremove -y
apt-get clean
rm -rf /var/lib/apt/lists/partial/* /tmp/* /var/tmp/*

设置GDAL_VERSION(从gdal-checkout.txt读取,为trunk,表示从svn主干分支下载源代码),下载gdal源代码到/tmp/gdal目录,下载编译器clang和python环境,对gdal的trusty_clang的travis安装脚本打补丁(通过修改后调用diff工具生成patch),安装gdal,清理临时文件。

docker社区的geodata/gdal镜像dockerfile分析的更多相关文章

  1. 官方Tomcat镜像Dockerfile分析及镜像使用

    官方Tomcat镜像 地址:https://hub.docker.com/_/tomcat/ 镜像的Full Description中,我们可以得到许多信息,这里简单介绍下: Supported ta ...

  2. Docker探索系列2之镜像打包与DockerFile

    preface docker基本入门以后,可以试试打包docker镜像与dockerfile了 docker镜像 docker hub仓库有2类仓库,用户仓库和顶层仓库,用户仓库由docker用户创建 ...

  3. Docker(2):使用Dockerfile创建支持SSH服务的镜像

    1.创建工作目录 # mkdir sshd_ubuntu # ls 在其中,创建Dockerfile和run.sh文件 # cd sshd_ubuntu/ # touch Dockerfile run ...

  4. centos7下安装docker(3.3创建镜像--修改dockerfile)

    1.我们在制作dockerfile的时候可能有些命令无法执行,导致镜像无法创建成功,这时我们可以修改dockerfile,从而达到我们的目的 查看Dockerfile内容 创建新的镜像,失败 Dock ...

  5. 在docker hub,用github的dockerfile自动生成docker镜像

    简介: 我已经深深的爱上了docker技术. 在日常使用中,经常看到docker hub 中有很多autobuild的镜像.基本使用是在github中上传dockerfile,过一会儿,docker ...

  6. CMD centos7 安装 最新版本的docker -- dockerfire 原语 ENTRYPOINT - 导入镜像 tar mariadb Dockerfile 构建镜像

    yum update # vim /etc/yum.repos.d/docker.repo //添加以下内容 [dockerrepo] name=Docker Repository baseurl=h ...

  7. Docker 学习笔记 (一)Dockerfile 创建本地镜像

    一.测试环境 OS version: CentOS Linux release 7.5.1804 (Core) docker cluster : master 1 + data node 4 dock ...

  8. Docker如何制作镜像-Dockerfile的使用

    1:什么是Dockerfile Dockerfile是一个文本文档,可以通过docker build 命令构建成一个镜像. 我们可以在Dockerfile中定义一系列的命令,构建出我们想要的镜像. 想 ...

  9. Docker详细介绍安装与镜像制作和拉取

    一.Docker是什么? 产生背景: 开发和运维之间因为环境不同和导致的矛盾(不同的操作系统.软件环境.应用配置等)DevOps 代码.系统.环境.配置等封装成镜像Image--->运维: 集群 ...

随机推荐

  1. v-bind:的基本用法

    1. v-bind:class(根据需求进行选择) <style> .box{ background-color: #ff0; } .textColor{ color: #000; } . ...

  2. JavaScript:回调模式(Callback Pattern) (转载)

    JavaScript:回调模式(Callback Pattern) 函数就是对象,所以他们可以作为一个参数传递给其它函数: 当你将introduceBugs()作为一个参数传递给writeCode() ...

  3. Hibernate之CRUD实践

    Hibernate作为一个高度封装的持久层框架,曾经是非常牛逼的,现在虽然应用不是特别广,比如我前公司主要是做OA的,应用的框架就是Spring+SpringMVC+Hibernate. Hibern ...

  4. n维向量旋转(循环移位)——学习《编程珠玑》

    问题: 将一个n元一维向量向左旋转i个位置.例如,当n=8且i=3时,向量abcdefgh旋转为defghabc. 简单的代码使用一个n元的中间向量在n步内完成该工作. 你能否仅使用数十个额外字节的存 ...

  5. 【luogu P4017 最大食物链计数】 题解

    题目链接:https://www.luogu.org/problemnew/show/P4017 DAG + DP #include <queue> #include <cstdio ...

  6. mysql事务隔离

    一.事务的特性 原子性.一致性.隔离性.持久性 二.事务的隔离级别 1.未提交读 (Read Uncommitpeatableted) 臭名昭著的脏读 ,事务A读到事务B未提交的数据 2.提交读RC( ...

  7. c#数据库访问服务(综合数据库操作)

    前面给大家说封装了常用的数据库,并且整理了使用.最近我再次把项目整合了.做成比较完善的服务. 还是重复的说下数据库操作封装. berkeley db数据库,Redis数据库,sqlite数据库. 每个 ...

  8. wait();notify();简单例子

    public class Test1{ /** * @param args */ public static void main(String[] args) { new Thread(new Thr ...

  9. CentOS6.5 虚拟机 磁盘扩容

    1. 关闭虚拟机 2. 编辑虚拟机设置:增加硬盘的置备大小,或者添加新的硬盘 3. 启动虚拟机,查看可用磁盘大小 : # df -Th Filesystem Type Size Used Avail ...

  10. 基于jquery,ajax请求及自我终止的函数封装。

    场景描述: 在我们平时的开发过程中,经常会遇到这样的情况.在搜索功能中进行模糊搜索或者联想关联. 这就要我们每次对输入框中的数据进行改动时,都要发送一次请求.当在短时间内多次操作改动时,问题就出现了. ...