An official Docker image for GMT?

Is there any work on making a dockerized version of GMT6? It would be great to be able to incorporate an official image of GMT6 into other docker containers.

Good question! We use dockers for our CI processes, though to my knowledge there has not been work on publishing an image. @pwessel, do you know if this has been previously considered?

Not sure, the folks who might know are @leouieda and @seisman. I can barely spell docker.

I can see that docker is useful in some cases, but I have limited knowledge about how to build a docker image.

I have very limited experience with Docker as well. If anyone in the community would like to develop this, of course I think we’d be more than happy to help get the word out (website, social media, documentation, etc).

@rterry if you know how to build an image (or know someone who does) this contribution would be appreciated :slightly_smiling_face: We always have trouble deploying GMT in some cases and having a ready image might help (like the Binder setup that keeps breaking).

Hi, is there any news about an official docker image? I’ve seen nc5ng/gmt on docker hub but looks like is not maintained.

We want to use pygmt to previsualize data. The target is to have all our backend applications deployed with docker containers. I tried to make a Dockerfile but it looks tricky with conda.

Any tips would be more than welcome.

1 Like

I used…

RUN conda install gmt --channel conda-forge

in my dockerfile.

I have an image with jupyter/scipy-notebook as the base image. I remember having difficulties installing GMT in a docker, which is why I started this thread. Once I got my image running successfully with GMT and pygmt, I used this image as base image into any new images.

For pygmt, I pip installed pygmt 0.1.2 for this to work. Unfortunately you could not choose which gmt version you installed in the conda command (maybe you can now?) so if the pygmt version you install is not compatible with the GMT version, then it doesn’t work.

conda install gmt=6.1.1 --channel conda-forge

This command should allow you install a specific GMT version.

Thanks! I remember trying to do a specific version in the docker and conda would be stuck on solving environment. Next time I update the base docker image, I’ll try a version!

Thank. I kept trying I guess it’s not the right way to do it. The image build is very long. I had to remove some dependencies compare to the documentation. The volume of the image is around 3.6 Gb.
For now I just need to draw points on a map so it works. I got the png file I expected.


name: pygmt
  - conda-forge
  - python=3.9
  - pandas
  - packaging 
  - gmt=6.1.1
  - pygmt


FROM continuumio/miniconda3


# Create the environment:
COPY environment.yml .
RUN conda env create -f environment.yml

# Copy script 
# input: csv file
# output: png image : map (shorelines and borders) with markers at some coordinates

# activate pygmt env
ENTRYPOINT ["conda", "run", "-n", "pygmt"]


version: '3.6'

    build: .
    container_name: container-pygmt
      - "/home/tromuald/data/bgi/:/data:rw"
    command: python /data/landata_516.csv 

Ping gmt to 6.1.1 may be a bad idea here, because latest PyGMT only supports GMT>=6.2.0.

name: pygmt
  - conda-forge
  - python=3.9
  - pandas
  - packaging 
  - gmt=6.1.1
  - pygmt

The volume of the image is around 3.6 Gb.

I’m not an expert on docker, but I think the volume of the docker image can be decreased if you clean up all the cached packages (running a command like conda clean --all after creating the environment).

Ok for the version I took the latest then.

The volume of the docker image could be decreased of 1Gb with this command, thanks!

RUN conda env create -f environment.yml && \
    conda clean --all