简体   繁体   中英

Installing a specific version of GDAL within a Docker container?

I am trying to setup a Docker container for a Django site, but it relies on a version of GDAL that does not appear to be installable from the command line (1.8.1).

In order to install this locally, I have to first run Configure and Make in the source folder. But I cannot find information online on how to run multi-step processes like this (perhaps running a bash script?)

How do I instruct the Dockerfile to Configure/Make/Install from source? Also, is there a way to avoid having to containerize the source for this process?

Specifics:

  • Docker running Python2.7 alpine
  • Django site
  • RHEL 7.6

Thanks in advance

UPDATE: Here's a specific log from what happens while trying to run 'pip install gdal==1.8.1' in the Dockerfile without GDAL installed

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

Why do the work someone else already did?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM