Running dockerized google earth engine (GEE) map
The steps I took to open and run a dockerized geemap:
- Install docker and learn some useful commands
- Gather the geemap image from https://hub.docker.com/r/bkavlak/geemap with a
docker pull
because it seemed like the most updated. I did not follow the instructions for staring things there exactly. I also used a nice youtube video from Simon Mudd. So the following instructions are somewhat bespoke. - Make a local directory
~/geemap-data
which will be the bridge between the container running the application and my local computer - Start the docker container based on the image by running:
docker run -it --name geemap -p 8888:8888 -v ~/geemap-data:/geemap/data bkavlak/geemap:latest
- This will put me inside the container, where I should see the
data
directory that is connected to my~/geemap-data
local folder. - Start a jupyter environment by running:
jupyter lab --ip=0.0.0.0 --port=8888 --allow-root
- Open
localhost:8888
and copy-paste the uniquetoken=...
into the browser. - Start a notebook and run
ee.Authenticate()
to go through the pipeline of getting an authentication token. This needs to be done everytime I open the container. There’s probably a way around this but it’s not a huge deal to re-authenticate when I’m starting work for the day. - Work away and save everything into
data/
(which will pipe it to my local~/geemap-data
folder). - When I exit the container, I also need to delete it or it won’t open next time due to the name being taken. I have tried to just re-open the container, but I’m having problems there. Again, not ideal but it works for now! This is how I drop the container (the image stays though so it makes for quick rebooting from step 4 above):
docker ps -a docker rm -f <container-ID>
Now I can make some sweet maps:
Some more notes on docker
On my M2 Mac with arm64
Apple Silicon architecture, I need to build images by adding FROM --platform=linux/amd64 <parent-image>
to the top of the Dockerfile
.
Then I can build as usual with docker build -t <image-name> .
Then when I want to run an image locally I need to supply the platform with docker run -it --platform linux/amd64 <image-name>