Skip to content

Installation with Docker

HiroYokoyama edited this page Oct 11, 2025 · 4 revisions

Installation with Docker

Using Docker is the recommended method for running moleditpy.

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.

1. Prerequisites

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

2. 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 moleditpy-app

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.


For Linux Users

  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 \
           moleditpy-app

For macOS Users

  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

For Windows Users (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

3. 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.

Clone this wiki locally