The idea / motivation

In order to run VisualVM from predefined configuration you need to point the app to the user directory. This directory takes about 20MB, but 90% of the the content is actually generated or repeated.

➜  4devops-visualvm git:(master) du -sh tw-sl/*
244K    tw-sl/config
7.3M    tw-sl/modules
 52K    tw-sl/repository
4.0K    tw-sl/update
104K    tw-sl/update_tracking
 11M    tw-sl/var

➜  4devops-visualvm git:(master) du -sh tw-wool/*
248K    tw-wool/config
7.2M    tw-wool/modules
 60K    tw-wool/repository
4.0K    tw-wool/update
104K    tw-wool/update_tracking
 11M    tw-wool/var

➜  4devops-visualvm git:(master) du -sh tw-wool
 19M    tw-wool

The only part that is specific and worthy of maintaining in the Git repo is repository

➜  4devops-visualvm git:(master) du -sh tw-wool/repository/*
 16K    tw-wool/repository/hosts
 44K    tw-wool/repository/jmxapplications
➜  4devops-visualvm git:(master) tree tw-wool/repository
├── hosts
│   ├──
│   ├──
│   ├──
│   └──
└── jmxapplications
    ├── 1445526765721.jmx
    │   └──
    ├── 1445526765722.jmx
    │   └──
    ├── 1445526765723.jmx
    │   └──
    ├── 1445526765724.jmx
    │   └──
    ├── 1445526765725.jmx
    │   └──
    ├── 1445526765726.jmx
    │   └──
    ├── 1445526765727.jmx
    │   └──
    ├── 1445526765728.jmx
    │   └──
    ├── 1445526765729.jmx
    │   └──
    ├── 1445526765730.jmx
    │   └──
    └── 1445526765731.jmx
13 directories, 15 files

which contains the hosts and JMX app definitions

Ideally, we would want to have Docker container that would encapsulate the VisualVM install and provide as external volume only the configuration part. This part is small enough (and textual) so that it can be maintained efficiently in Git while the common and generated files(rest of the 20MB) will be inside container

Quick and dirty solution

For this to work, we need Docker container capable of running GUI application and efficient client access (e.g. VNC)

Starting point is

I have tested the container and selected xfce+ubuntu for start

➜  ~ docker run -d -p 5901:5901 -p 6901:6901 -e VNC_RESOLUTION=800x600 consol/ubuntu-icewm-vnc
➜  ~ docker run -d -p 5901:5901 -p 6901:6901 consol/centos-xfce-vnc
Connect with JollyFastVNCPro - port 5901 / vncpassword

I have installed inside this container visualVM, ssh client using docker exec and made commit (actually, 3 commits).

The result is available at thinkwrap/ubuntu-xfce-vnc-visualvm:v3 (private image)

How to use it

Create local directory for the shared information containing only hosts and JMX property files. Here is mine

➜  test-config tree sim-prod
└── repository
    ├── hosts
    │   ├──
    │   ├──
    │   ├──
    │   ├──
    │   └──
    └── jmxapplications
3 directories, 5 files
➜  test-config ll
total 32
-rw-r--r--@ 1 miro  staff    16K 19 Nov 20:43 hosts-file
drwxr-xr-x  3 miro  staff    96B 19 Nov 20:35 sim-prod

Also, copy the /etc/hosts file as hosts-file so that Docker uses your known mappings

Start container with desired resolution and 2 volumes - one for mapped config and one for hostfile

test-config docker run -d -p 5901:5901 -p 6901:6901 -e VNC_RESOLUTION=800x600 -v /Users/miro/src/DEVOPS/test-config/sim-prod/repository:/headless/.visualvm/1.3.8/repository -v /Users/miro/src/DEVOPS/test-config/hosts-file:/etc/hosts thinkwrap/ubuntu-xfce-vnc-visualvm:v3

Connect via Web or via VNC client (use vncpassword as vnc password). Degree of uglyness will depend on the client used. The URL to connect to is localhost:5901.

On Mac, you can use OOTB Share Screen app with URL vnc://localhost:5901

Start VisualVM using shortcut - note that provided config is loaded