Reputation: 3587
I'm using Docker to build and run my projects.
I need to use gdal
library, but using pip install gdal
I have lots of error, so I tried to download from https://github.com/OSGeo/gdal/tree/master/gdal/docker the GDAL docker images.
Now I would like to run my .py file but I have to import also TensorFlow and Numpy and other libraries. GDAL docker image, as I expected, doesn't come with other libraries.
Is there a way to build a new image from GDAL docker image and include other libraries?
I tried to make something similar with Nvidia TF docker image and it works (Dockerfile down below) without gdal library installed, but if I change FROM osgeo/gdal
(name of GDAL image) I have an error pip can't be find
.
#Dockerfile
FROM nvcr.io/nvidia/tensorflow:19.12-tf2-py3
WORKDIR /work
COPY requirements.txt ./
RUN pip install -r requirements.txt
Any advise?
Upvotes: 2
Views: 666
Reputation: 3587
I found the solution:
FROM osgeo/gdal
RUN apt-get update
RUN apt install -y python3-pip
WORKDIR /work
COPY requirements.txt ./
RUN pip install -r requirements.txt
After that, you can install TF via requirements.txt file and you are done!
Upvotes: 1