Search code examples
pythondockergoogle-earth-engine

Installing Python modules on the (local) Google Earth Engine Docker image


I'm new to docker and Google Earth Engine. I'm using Docker CE and followed the instructions for locally running GEE Datalab. Dockers runs fine and I can access the GGE IDE.

I now want to install some additional Python packages. I have no idea how to do this. It seems like the GGE image has pip installed but I don't know how to access it. I saw a different SO question about docker that suggested you need to edit the image itself to add the pip install commands, but I can't find the actual docker image on my machine. What is the correct way to install additional Python packages for use with Google Earth Engine?


Solution

  • You can create a Dockerfile and build a new image for extending those additional python packages. So in one folder you should have a Dockerfile and requirements.txt.

    Dockerfile should be like:

    FROM <GEE_image>
    WORKDIR /usr/src/app
    COPY . .
    RUN pip install -r requirements.txt
    

    Then run docker build <location_of_dockerfile> -t <new_image_name> then just run it.

    Or another method would be to just ssh inside the existing GEE container like docker exec -it <container_id> bash and manually install the additional python packages there.

    TAKE NOTE: You can not change an image owned by anyone. You can just extend it and create your own