在 Docker 容器中安装特定版本的 GDAL?

Installing a specific version of GDAL within a Docker container?

我正在尝试为 Django 站点设置一个 Docker 容器,但它依赖于一个似乎无法从命令行 (1.8.1) 安装的 GDAL 版本。

为了在本地安装它,我必须先 运行 在源文件夹中进行配置和制作。但是我无法在网上找到有关如何 运行 像这样的多步骤过程的信息(也许 运行 宁一个 bash 脚本?)

如何从源代码指示 Docker 文件到 Configure/Make/Install? 另外,有没有办法避免必须将此过程的源容器化?

细节:

提前致谢

更新:这是在未安装 GDAL 的情况下尝试 运行 'pip install gdal==1.8.1' 文件中的 运行 'pip install gdal==1.8.1' 时发生的具体日志

Collecting GDAL==1.8.1 (from -r requirements.txt (line 45))
  Downloading https://files.pythonhosted.org/packages/29/03/e9a666aeeebcfcfa0c07b56c440a4e9fc45161cbf41fc23099427458f11c/GDAL-1.8.1.tar.gz (400kB)
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/GDAL.egg-info
    writing pip-egg-info/GDAL.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/GDAL.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/GDAL.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/GDAL.egg-info/SOURCES.txt'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-htaYeH/GDAL/setup.py", line 263, in <module>
        ext_modules = ext_modules )
      File "/usr/local/lib/python2.7/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/usr/local/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/usr/local/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 296, in run
        self.find_sources()
      File "/usr/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 303, in find_sources
        mm.run()
      File "/usr/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 534, in run
        self.add_defaults()
      File "/usr/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 570, in add_defaults
        sdist.add_defaults(self)
      File "/usr/local/lib/python2.7/site-packages/setuptools/command/py36compat.py", line 36, in add_defaults
        self._add_defaults_ext()
      File "/usr/local/lib/python2.7/site-packages/setuptools/command/py36compat.py", line 119, in _add_defaults_ext
        build_ext = self.get_finalized_command('build_ext')
      File "/usr/local/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "/usr/local/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
        self.finalize_options()
      File "/tmp/pip-install-htaYeH/GDAL/setup.py", line 160, in finalize_options
        self.gdaldir = self.get_gdal_config('prefix')
      File "/tmp/pip-install-htaYeH/GDAL/setup.py", line 140, in get_gdal_config
        return fetch_config(option)
      File "/tmp/pip-install-htaYeH/GDAL/setup.py", line 89, in fetch_config
        raise gdal_config_error, e
    __main__.gdal_config_error: [Errno 2] No such file or directory

为什么别人已经做过的工作?

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