Instaling Gplates using docker

Hi everyone,

I recently ran into a common problem: The .deb package for GPlates 2.5.0 is built specifically for Ubuntu 24.04 (Noble), but my host system is running Kubuntu 26.04.

Because the library versions on my host (like libboost, libgdal, etc.) are newer or named differently, apt and dpkg fail with dependency errors:

Depends: libboost-program-options1.83.0 ... but it is not installable Depends: libgdal34t64 ...

Trying to downgrade system libraries is risky and would likely break the installation. Don’t try this!

The Solution: Running GPlates inside a Docker container based on Ubuntu 24.04. This creates an isolated environment where the exact dependencies required by the .deb file are available, without touching my host system.

Here is the step-by-step guide I used.

Prerequisites

  • Docker installed on your host: sudo apt install docker.io

  • The GPlates .deb file: gplates_2.5.0_ubuntu-24.04-amd64.deb

Step 1: Create the Project Folder

Create a folder (e.g., gplates-docker) and move your .deb file into it:

mkdir gplates-docker
cd gplates-docker
cp ~/Downloads/gplates_2.5.0_ubuntu-24.04-amd64.deb .

Step 2: Create the Dockerfile

A Dockerfile is simply a file named Dockerfile (no extension) with instructions to build the container. It sets up Ubuntu 24.04, enables the universe repository, and installs all the specific dependencies GPlates 2.5.0 needs.

Create a file named Dockerfile and paste this content:

# Start with the official Ubuntu 24.04 image
FROM ubuntu:24.04

# Prevent interactive prompts during installation
ENV DEBIAN_FRONTEND=noninteractive

# Phase 1: Update the base lists and enable 'universe'
RUN apt-get update && \
    apt-get install -y software-properties-common && \
    add-apt-repository universe && \
    # CRITICAL: Update again to fetch package lists for the newly added 'universe' repo
    apt-get update && \
    rm -rf /var/lib/apt/lists/*

# Phase 2: Install all dependencies (including the newly discovered ones)
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    libboost-program-options1.83.0 \
    libboost-python1.83.0 \
    libboost-python1.83.0-py312 \
    libgdal34t64 \
    libpython3.12t64 \
    libqt5opengl5t64 \
    libqwt-qt5-6 \
    libgl1 \
    libglu1-mesa \
    libx11-6 \
    libxext6 \
    libxrender1 \
    libxrandr2 \
    libxcursor1 \
    libxi6 \
    libxtst6 \
    libglib2.0-0 \
    libsm6 \
    libice6 \
    libpulse0 \
    libglvnd0 \
    libegl1 \
    libgles2 \
    # The 3 new missing packages
    libglew2.2 \
    libqt5xml5t64 \
    libqt5xmlpatterns5 \
    && rm -rf /var/lib/apt/lists/*

# Copy your .deb file into the container
COPY gplates_2.5.0_ubuntu-24.04-amd64.deb /tmp/gplates.deb

# Install the .deb file and fix dependencies
RUN dpkg -i /tmp/gplates.deb || apt-get install -f -y && \
    rm -rf /var/lib/apt/lists/* /tmp/gplates.deb

# Set the entry point
ENTRYPOINT ["gplates"]

Step 3: Build the Image

Run the build command in the folder where the Dockerfile and the .deb file are located. This might take a few minutes:

docker build --no-cache -t gplates-docker-img .

Step 4: Create a Launcher Script

To make it easy to run, create a script in your ~/.local/bin folder.

  1. Create the directory if needed:

    mkdir -p ~/.local/bin
    
  2. Create the script file: nano is a text editor that runs within the terminal:

    nano ~/.local/bin/gplates-docker
    
  3. Paste this content (this handles the X11 display forwarding):

    #!/bin/bash
    xhost +local:docker >/dev/null 2>&1
    docker run --rm -it \
      -e DISPLAY=$DISPLAY \
      -v /tmp/.X11-unix:/tmp/.X11-unix \
      gplates-docker-img "$@"
    
  4. Save and exit: Press Ctrl+O, then Enter to save, and Ctrl+X to exit.

  5. Make it executable:

    chmod +x ~/.local/bin/gplates-docker
    

Step 5: Run GPlates

Now you can launch GPlates just like a normal app:

gplates-docker

I hope this helps others who want to keep updating their Kubuntu installation while still using GPlates!

It is possible to get GPU acceleration in applications running in docker containers instead of relying on the slower CPU rendering.

By default, Docker containers cannot access your NVIDIA GPU unless you install the NVIDIA Container Toolkit (open-source!). Here is the official, step-by-step method to enable it, verified against the latest documentation:

Update Your GPlates Launcher Script

After installing the container toolkit, it is necessary to update the launcher script tell Docker to use the GPU.

1. Edit the script:

nano ~/.local/bin/gplates-docker

2. Add --gpus all to the docker run command. It should look like this:

#!/bin/bash
xhost +local:docker >/dev/null 2>&1

# Added '--gpus all' below
docker run --rm -it \
  --gpus all \
  -e DISPLAY=$DISPLAY \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  gplates-docker-img "$@"

3. Save and Exit: (Ctrl+O, Enter, Ctrl+X).

Step 4: Run GPlates

Now launch GPlates:

gplates-docker