As a new commer, I would like to know about integration of two images.
I have a flask app that would be parent image. That would use another image that contains geo libraries such as gdal, proj, geos.
How can I construct this structure. Dockerfile or any other way?
Docker images donāt combine like that. An image only has one parent image, and thereās no provision to merge the filesystems of two images.
Your question is a little unclear to me, so Iāll suggest two paths that sound like what youāre saying:
You can build your own ābase imageā that has the upstream python:3 with the GIS libraries you need added in; then install your actual application on an image based on that.
python:3 --> my_python_gis --> my_flask_app
You could split your application into a āfront endā, which has your existing Flask application, and a āback endā, which has the GIS libraries. Youād need to write a second application in the āback endā container (a second Flask app would be fine) and then connect to it from the āfront endā container (e.g., using the requests library). If the set of calls into the āback endā application was pretty stable, you could iteratively develop the āfront endā application and redeploy only that as it changed.
Thank you,
I was just planning to use flask to serve gis - maps that require gdal as a library.
I have flask and gdal images separately. I had thought to combine them.
I agree with @dmaze although itās fair to say there isnāt a right or wrong way to do this. Docker attracts a lot of commentary for solution designs that favour the decomposition of larger applications into micro-services and on the whole that can be a successful pattern. So in your example your would likely split the backend and front end functionality into separate containers, and you might even go further than that depending on other implementation details which you have not shared. For example you might have a caching layer, a messaging layer, some external APIs that get called and so on. All of those are candidates as micro-services. Of course the value proposition here is that it is (in some ways) easier to scale independent components, it creates a more loosely coupled but coherent design (so its easier to swap out individual parts) and managing the life-cycle of the micro-services also potentially gives rise to less breaking change, or at least reduces its blast radius. OTOH, highly distributed apps can be MUCH harder to reason about when things go wrong and can bring into play temporal dependencies, race conditions and other complex considerations. For that reason, some still prefer to use docker more as a packaging and distribution format for self contained apps (some might call this a monolith but that suggests that itās wrong, and IMO it isnāt, itās just a design choice). Your idea of ācombiningā the functionality would likely turn into a Dockerfile that implements a multi-stage build.