Skip to content

Installation with Docker

Hiromichi Yokoyama edited this page Aug 5, 2026 · 4 revisions

Installation with Docker

This page covers running moleditpy in Docker. For most users, moleditpy-installer (see Installation for Windows / macOS / Linux) is the simpler route; Docker is an alternative if you want an isolated, reproducible environment without installing Python dependencies on your host system.

GUI applications like moleditpy depend on many complex system libraries for graphics, windowing, and keyboard input. Using Docker creates a self-contained environment with all these dependencies included, allowing you to run the application easily and reliably without altering your host system.

Prerequisites

Before you begin, please ensure the following software is installed on your system:

  • Git: Required to clone the repository.

  • Docker: Please install Docker for your operating system.

  • X11 Server (Required for GUI Display): An X11 server is necessary to display the application's GUI from within the container on your desktop.

    • Linux: Typically included by default in most desktop Linux distributions. No additional installation is required.
    • macOS: Install and run XQuartz.
    • Windows: Install and run an X11 server like VcXsrv. (This may not be necessary if you are using WSL2 with WSLg support.)

Installation steps

Step 1: clone the repository

First, clone this repository to your local machine.

git clone https://github.com/HiroYokoyama/python_molecular_editor_docker.git
cd python_molecular_editor_docker

Step 2: build the Docker image

In the root directory of the repository (where the Dockerfile is located), run the following command to build the Docker image.

docker build -t moleditpy-app .
  • The -t moleditpy-app flag tags the image with the name moleditpy-app.
  • The final . specifies that Docker should use the Dockerfile in the current directory.
  • The initial build may take several minutes.

Step 3: run the application

Follow the instructions for your operating system to launch the container and run moleditpy.


Linux

  1. (One-time setup) Open a terminal on your host machine and allow connections from local containers:

    xhost +local:docker
  2. Launch the container:

    docker run --rm -it \
        -e DISPLAY=$DISPLAY \
        -v /tmp/.X11-unix:/tmp/.X11-unix \
        -v moleditpy-data:/data \
        -v moleditpy-setting:/root/.moleditpy \
        moleditpy-app

macOS

  1. Launch XQuartz. In XQuartz's settings, ensure "Allow connections from network clients" is checked in the "Security" tab.

  2. Open a terminal on your host machine and allow connections:

    xhost + 127.0.0.1
  3. Launch the container:

    docker run --rm -it \
           -e DISPLAY=host.docker.internal:0 \
           moleditpy-app

Windows (with VcXsrv)

  1. Launch VcXsrv. When launching, it is recommended to check the "Disable access control" box.

  2. Find your host machine's IP address. Open Command Prompt or PowerShell and run ipconfig to find the IPv4 address of your active network adapter.

  3. Launch the container. Replace <your-ip-address> with the IP address you found in the previous step.

    docker run --rm -it \
           -e DISPLAY=<your-ip-address>:0.0 \
           moleditpy-app

Troubleshooting

  • If you get an Error: cannot open display message:

    • Ensure your X11 Server (XQuartz, VcXsrv) is running.
    • Verify that the xhost command was executed correctly.
    • Double-check that the DISPLAY environment variable is set correctly for your environment.
  • If you get a Cannot connect to the Docker daemon message:

    • Make sure the Docker Desktop application or the Docker service is running.

See also

Clone this wiki locally