Skip to content

Commit

Permalink
Docker: updated documentation and added SSH version.
Browse files Browse the repository at this point in the history
  • Loading branch information
nuthub committed Dec 15, 2024
1 parent 0a0f3a8 commit d291511
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 99 deletions.
17 changes: 0 additions & 17 deletions Dockerfile

This file was deleted.

6 changes: 6 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# CARiSMA in a docker container

There are two ways to run CARiSMA in a docker container:

* [local](local/): a docker file and instructions for how to run CARiSMA, if you have docker installed on your local machine and a display is attached to your local machine. This makes use of direct X11 forwarding.
* [remote](remote/): a docker file and instructions for how to run CARiSMA, if you have docker installed on a remote machine, you want to connect via SSH to that remote machine and want to use CARiSMA on your local machine with a display attached. This makes use of SSH's X11 forwarding feature.
4 changes: 2 additions & 2 deletions docker/Dockerfile-x → docker/local/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Make sure X connection is allowed (run `xhost +`)
# Make sure you have some X server running and that X connections are allowed (run `xhost +`)
FROM --platform=linux/amd64 ubuntu:24.04

# Install Java, wget, openjdk. OpenJDK is required although "shipped with the product" (already checked)
Expand All @@ -12,7 +12,7 @@ RUN apt-get clean

# install carisma
RUN mkdir /opt/carisma \
&& wget -cq https://github.com/CARiSMA-Tool/carisma-tool/releases/latest/download/carisma-product-linux.gtk.x86_64.tar.gz -O /tmp/eclipse.tar.gz \
&& wget -c https://github.com/CARiSMA-Tool/carisma-tool/releases/latest/download/carisma-product-linux.gtk.x86_64.tar.gz -O /tmp/eclipse.tar.gz \
&& tar -zxf /tmp/eclipse.tar.gz -C /opt/carisma \
&& rm /tmp/eclipse.tar.gz

Expand Down
39 changes: 39 additions & 0 deletions docker/local/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Prepare X server on local machine
## MacOS
1. Install XQuartz and configure XQuartz to Allow Connections (on first start)
* Open XQuartz preferences
* Go to Security tab
* Allow connections from network clients
* Restart
2. Look up host IP address. In XQuartz run: `ifconfig en0 | grep inet | awk '$1=="inet" {print $2}'`
3. Allow connections from your host IP. In XQuartz run: `xhost + <your_host_ip>`

## Linux
1. Make sure you have some X11 server running. If you're on wayland, you can use XWayland, which allows you to run X11 applications on wayland.
2. Allow X connections from the container to your local machine (host): Make sure you have the command `xhost` available at your local machine. You can try `which xhost`, which should tell you the path to your executable. The package you may need to install, depends on your distribution.
3. In a shell on the local machine run `xhost +`

## Windows
1. Install and configure XLaunch:
* Select "Multiple windows" and set "Display number" to 0 and click "Next"
* Choose "Start no client" and click "Next"
* In "Extra settings" tick all boxes and cick "Next"
* Click "Finish"
3. Open your Console and type `set DISPLAY=host.docker.internal:0.0` and press "Enter"

# Build the image and run the container

1. Build the Docker image. In your console run:

```
docker build -t carisma .
```
3. Run the Docker container with X11 forwarding:

```
docker run -it \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
carisma
```
4. Eclipse should start automatically
2 changes: 1 addition & 1 deletion docker/Dockerfile-ssh → docker/remote/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ RUN apt-get clean

# install carisma
RUN mkdir /opt/carisma \
&& wget -cq https://github.com/CARiSMA-Tool/carisma-tool/releases/latest/download/carisma-product-linux.gtk.x86_64.tar.gz -O /tmp/eclipse.tar.gz \
&& wget -c https://github.com/CARiSMA-Tool/carisma-tool/releases/latest/download/carisma-product-linux.gtk.x86_64.tar.gz -O /tmp/eclipse.tar.gz \
&& tar -zxf /tmp/eclipse.tar.gz -C /opt/carisma \
&& rm /tmp/eclipse.tar.gz

Expand Down
9 changes: 9 additions & 0 deletions docker/remote/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Run CARiSMA in a container via an SSH connection
The docker file in this directory allows you to create an ubuntu container on a remote machine that you can connect to via ssh and start CARiSMA to display the GUI on the connecting machine, where a display is attached. Performance depends on the network connection.

1. On the (remote) docker host: create an authorized_keys file in the directory, where you have the `Dockerfile`. The `authorized_keys` file contains the public SSH key(s) of user(s) that will be allowed to login to the container via their private SSH key(s).
2. On the (remote) docker host: build the image with `docker build -t carisma .`
3. On the (remote) docker host: run the container and optionally map some available docker host port (e.g. 2222) to the container's SSH port (22) with `docker run -it -p 2222:22 carisma`
4. On the local host: connect via ssh (with X11forwarding) and run CARiSMA: `ssh -X -p 3000 root@<docker-host> /opt/carisma/carisma-launcher`
5. Enjoy CARiSMA

80 changes: 1 addition & 79 deletions documentation/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,82 +44,4 @@ To install CARiSMA via the Update Site ZIP file do the following:
5. Wait for the installation to finish and restart Eclipse.

# Setting up CARiSMA via Docker Container

## Documentation to start on MacOS

### 1. Install XQuartz

### 2. Configure XQuartz to Allow Connections (on first start)
* Open XQuartz preferences
* Go to Security tab
* Allow connections from network clients
* Restart

### 3. Look up host IP address
In xQuartz run :
```
ifconfig en0 | grep inet | awk '$1=="inet" {print $2}'
```

### 4. Allow connections from your host IP:
In xQuartz run :
```
xhost + <your_host_ip>
```

### 5. Build the Docker image
In you console run :
```
docker build -t carisma-container .
```

### 6. Run the Docker container with X11 forwarding:
```
docker run -it \
-e DISPLAY=<your_host_ip>:0 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
carisma-container
```

### 7. Eclipse should start automatically

## Documentation to start on Linux

1. Make sure you have some X11 server running. If you're on wayland, you can use XWayland, which allows you to run X11 applications on wayland.
2. Make sure you have the command `xhost` available (try `which xhost`, which should tell you the path to your executable). The package you may need to install, depends on your distribution.
3. Allow connections from your host IP. In a shell run `xhost +`.
4. Build the Docker image: `docker build -t carisma-container`.
5. Run the Docker container with X11 forwarding and enjoy CARiSMA:

```
docker run -it \
-e DISPLAY=:0 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
carisma-container
```

## Documentation to start on Windows

### 1. Install XLaunch

### 2. Open XLaunch
* Select "Multiple windows" and set "Display number" to 0 and click "Next"
* Choose "Start no client" and click "Next"
* In "Extra settings" tick all boxes and cick "Next"
* Click "Finish"

### 3. Open your Console
* Type "set DISPLAY=host.docker.internal:0.0" and press "Enter"

### 4. Build the Docker image
In you console run :
```
docker build -t carisma-container .
```

### 5. Run the Docker container with X11 forwarding:
```
docker run -it -e DISPLAY=<your_host_ip>:0 -v /tmp/.X11-unix:/tmp/.X11-unix carisma-container
```

### 6. Eclipse should start automatically
Please refer to the documentation in the [docker directory](../docker/) on how to run CARiSMA in a docker container.

0 comments on commit d291511

Please sign in to comment.