Hosting Slicer on Public Server Using Docker and dit4c - QIICR/ProjectIssuesAndWiki GitHub Wiki
Hosting Slicer on Public Server Using Docker and dit4c
Using docker, dit4c, and a server, one can host a jointly-editable version of Slicer on a webpage. This can be a great help for public demos or tutorials, or meetings in which different users may want to highlight different parts of an image. Here is a short tutorial for my experience with dit4c so far, but it is not exhaustive - feel free to add your own instructions, clarifications, or tips.
-
Download and install Docker to your server of choice. Docker is a platform to deploy Linux applications in streamlined “containers” (virtual machines) that can run in any user environment. Fairly detailed installation instructions can be found for any OS at https://docs.docker.com/engine/installation/.
-
Pull dit4c’s Slicer container from their page on Docker Hub here: https://hub.docker.com/r/dit4c/dit4c-container-slicer/. dit4c hosts a variety of data analysis tools in Docker containers – you can find more info on them here: https://hub.docker.com/r/dit4c/dit4c-container-slicer/. To pull the Docker container from dit4c’s docker-hub page, simply execute the command line option found under its “Docker Pull Command” window on the server where you installed Docker. If your installation of Docker proceeded correctly and your environment variables are set up to include Docker commands, the command line should immediately start displaying download progress for dit4c's container.
-
Once you have finished pulling the Slicer container, you can execute the following command to host your container: sudo docker run --name=slicer --detach=true --tty=true --interactive=true -p [port]:8080 dit4c/dit4c-container-slicer. The bolded portion is a mapping from the Docker container’s port to your web server’s port. The piece after the colon, 8080, is the container’s port and should always stay the same. The piece before the colon, [port], should be replaced by whichever port you would like to host Slicer on your computer/server. This port will dictate how you are able to access your public Slicer page; most servers' URLs take the form of [your-server-name]:[port].
-
Open a browser pointed towards whichever port you opened in the previous step. It will likely take the format of [your-server-name]:[port]. From there, you should be able to use a user interface to start an “X11 Session." This will redirect you to a desktop with only Slicer and a terminal installed. You can share the link to this public desktop with anyone with access to the server. Mouse and keyboard will be shared between all viewers. You can send terminal commands to the virtual machine running Slicer via the main user interface's “Shell Terminal” option. You can manage files via the user interface's “File Management” option. Given that Docker is simply a virtual machine running inside your server, any files saved or changed via the file manager will be retrievable from the Docker container in the future, even if the container is closed.
Notes:
A power-outage had caused our servers shut down, forcing us to restart our Docker container. Generally, one can restart the dit4c Slicer container using the following command:
docker start slicer
However, when this happened to us, the X11 Server (AKA the virtual machine desktop) would still not start. We had to remove the Slicer container and re-pull it from Docker Hub to get it working again. This caused us to lose data we had previously saved on to the container. Beware!