- Docker Registry @monstrenyatko/gui-app-run
- GitHub @monstrenyatko/docker-gui-app-run
- X11 server (e.g., X.Org, XQuartz 2.7.11+, Xming)
- X11 server is configured to accept network connections
- Docker 18.06.1+
docker
command is working withoutsudo
- Prepare environment/directories to persist state/plugins between container executions:
export WORK_ECLIPSE_HOME=$HOME/Eclipse
export WORK_ECLIPSE_BIN=$WORK_ECLIPSE_HOME/bin
export WORK_ECLIPSE_SETTINGS=$WORK_ECLIPSE_HOME/setting
export WORK_ECLIPSE_WORKSPACE=$WORK_ECLIPSE_HOME/workspace
mkdir -p $WORK_ECLIPSE_BIN $WORK_ECLIPSE_SETTINGS $WORK_ECLIPSE_WORKSPACE
- Download
Linux
Eclipse
package - Extract
Eclipse
package content to$WORK_ECLIPSE_BIN
directory. Path to executable file like$WORK_ECLIPSE_BIN/eclipse
must be valid - Create execution script for convenience:
#!/bin/bash
# Desired UID of the user inside container, keep it empty for default to `1000`
user_id=
# IP address of the host machine with running X11 server, see `host.docker.internal`
ip=<IP address>
# Allow connections to X11 server from host
# you might need to add IP of the docker machine, see `$(docker-machine ip $machine_name)`
xhost + localhost
# Remove old container if for some reason it was not removed automatically
docker rm eclipse
# Run
docker run --rm --name eclipse --net=host \
-e LOCAL_USER_ID=$user_id \
-e DISPLAY=$ip:0 \
\
-v $WORK_ECLIPSE_BIN:/opt/eclipse \
-v $WORK_ECLIPSE_WORKSPACE:/cfg/eclipse/workspace \
-v $WORK_ECLIPSE_SETTINGS:/cfg/eclipse/.eclipse \
-e ECLIPSE_HOME=/opt/eclipse \
-e SWT_GTK3=1 \
\
monstrenyatko/gui-app-run \
\
bash -c " \
ln -s /cfg/eclipse/workspace \$HOME/workspace \
&& ln -s /cfg/eclipse/.eclipse \$HOME/.eclipse \
\
&& \$ECLIPSE_HOME/eclipse \
"
-
Share host
Maven
repository if required:- Add to
Docker
run options:
-v $HOME/.m2/repository:/m2_repo \ -e M2_REPO=/m2_repo \
- Add to the
Docker
command beforeEclipse
binary invocation:
&& mkdir \$HOME/.m2 && ln -s \$M2_REPO \$HOME/.m2/repository \
- Add to
-
Make
UID
of theDocker
user equal with host user:- Change
user_id
variable value to:
user_id=`id -u $USER`
- Change
-
Get IP address automatically:
- Set
ip
variable value to:
ip=host.docker.internal
- From
en0
interface. Setip
variable value to:
ip=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
- Set
-
Switch to
GTK2
:- Change
SWT_GTK3
value to0
- Change
-
Allow connections from your local machine to the X server:
- Add before execution of the
docker
command:
xhost + $ip
- Add before execution of the
-
Use default GTK2 theme
- Add to the
Docker
command beforeEclipse
binary invocation:
&& unset GTK2_RC_FILES \
- Add to the
- Mac OS 10.13.6 High Sierra, XQuartz 2.7.11:
- Eclipse 4.6 Neon