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

时间:2019-04-03 19:13:40

标签: django docker makefile gdal rhel

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

为了在本地安装它,我必须首先在源文件夹中运行Configure and Make。但是我无法在线找到有关如何运行这样的多步骤流程的信息(也许正在运行bash脚本?)

我如何指示Dockerfile从源进行配置/制作/安装? 另外,有没有一种方法可以避免将源程序容器化?

具体:

  • 运行Python2.7 Alpine的Docker
  • Django网站
  • RHEL 7.6

预先感谢

更新:这是一个特定的日志,显示了在未安装GDAL的情况下尝试在Dockerfile中运行“ 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

1 个答案:

答案 0 :(得分:0)

为什么别人已经做了这项工作?

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