---
title: "Start Erlang's Dialyzer With GUI From A Docker Container"
blurb: "Everything in OTP is command-line driven, so using containers during development has been without issue. But, Dialyzer, Erlang's static analysis tool, actually has a Graphical User Interface. How can we still use Dialyzer and its GUI even though Elixir is running inside a container?"
...

I use Docker mostly when working on software projects and I figured out how to get Erlang's Dialyzer GUI working in a Docker container.

1. Start a container with X11 forwarding:

    ```console
    $ docker run -it --rm --net=host -e "DISPLAY" -e "NO_AT_BRIDGE=1" \
    -v "$XAUTHORITY:/root/.Xauthority:rw" elixir bash
    ```

2. Build ["the recommended minimal PLT for Erlang/OTP"](https://www.erlang.org/doc/apps/dialyzer/dialyzer_chapter#the-persistent-lookup-table):

    ```console
    # dialyzer --build_plt --apps erts kernel stdlib mnesia
    Creating PLT /root/.cache/erlang/.dialyzer_plt ...
    ...
    done (warnings were emitted)
    ```

3. Start the Dialyzer GUI:

    a. From the command line:

        ```console
        # dialyzer --gui
        ```

    b. From inside an IEx session:

        1. Start the Dialyzer application:

            ```
            iex(1)> Application.load(:dialyzer)
            :ok
            ```

        2. Start the Dialyzer GUI:

            ```
            iex(2)> :dialyzer.gui()
            ```

You should now see the Dialyzer GUI.

![dialyzer application window](/images/dialyzer.png)
