Setting up napari using containers - Part 1

What I learned playing with napari and containers.
tech
napari
python
visualization
containers
Author

Carol Willing

Published

November 19, 2024

Getting container images

The napari container images are available from the GitHub Container Registry.

napari container images

napari container images

There are two types of container images available:

  • napari
  • napari-xpra

Since I’m running a Mac M2, I’m going to use the napari-xpra container image since it doesn’t require an X server and hopefully will be less finicky.

Let’s run napari

I’m going to use the napari documentation instructions as a guide and I ran these specific steps:

  1. Make sure docker is installed and running on your system.

    docker --version
  2. From the root of your napari repo clone or fork, run (note: this could take a while even 5 minutes):

    docker build --target napari -t ghcr.io/napari/napari-xpra:latest .
    Supply chain check

    You can do a quick scan of the image after pulling it using docker scout. If you are logged into your Docker account, it will make sure that you have the latest version of Docker Scout.

  3. Run the container:

    docker run -it --rm -p 9876:9876 ghcr.io/napari/napari-xpra
  4. Open a browser and go to http://localhost:9876 to see the napari GUI. You should see the napari GUI in your browser.

    Safari browser

    Safari browser
    Check the interactivity of the GUI

    Unfortunately, using this in Safari was popping up a paste dialog instead of allowing me to interact with the GUI.

    I was able to connect to the container using Chrome. It brought up an xpra screen. I didn’t add any information to the form and clicked “Connect”. It then brought up the napari GUI.

    Chrome browser

    Chrome browser

Part 2 - Interacting with napari in the browser

In the next post, I’ll explore how to interact with napari in the browser. Stay tuned!

Back to top