Skip to content

Using Docker Images

gcielniak edited this page Apr 8, 2024 · 3 revisions

Install Docker on your computer (optional if you want to use your own computer)

To install Docker on your own computer (not needed, if you are using the SoCS lab computers!!), make sure you follow the instructions for your OS (Windows, MacOS, Linux) at https://docs.docker.com/get-docker/. Make sure you also have docker-compose installed (is default in the standard installation packages, so normally nothing needs to be done).

Getting the docker-compose file

The deployment of a Docker container can be made very easy and straight forward with the use of docker-compose. The configuration file for this module should be downloaded from https://raw.githubusercontent.com/LCAS/kasm-workspaces-core-images/develop/kasm-lcas-jammy.docker-compose.yaml. Save this single configuration file in a directory (e.g named lcas-docker, or similar). It is from this folder that you will start your docker container, so remember where it is.

Use the GPU image (only if you have an NVIDIA GPU and want to use it (CUDA), ignore otherwise)

If you have an NVIDIA GPU on your computer, you can use a CUDA-enabled version of the image. You only need to use another docker-compose file. Get it here: https://raw.githubusercontent.com/LCAS/kasm-workspaces-core-images/nvidia_develop/kasm-lcas-jammy.docker-compose.yaml

You also need to install the NVIDIA container runtime first on your computer that runs docker.

Starting up your container

  1. Open a terminal / powershell on your computer
  2. Log in to the L-CAS docker registry, i.e. run docker login lcas.lincoln.ac.uk, with user name lcas, and password lincoln
  3. Navigate to the directory where you have saved the file kasm-lcas-jammy.docker-compose.yaml (see above).
  4. In this directory run docker compose -f kasm-lcas-jammy.docker-compose.yaml pull (on slightly older docker installations the command is acutally docker-compose with a -). When you do this the very first time it will take quite a long time, as the image is being downloaded first from the registry. It's advisable to run this every time before you start working, to ensure you always have the latest version.
  5. Still in the directory, run docker compose -f kasm-lcas-jammy.docker-compose.yaml up -d, which will start the container with the virtual desktop (again, on your installation it may be docker-compose with a -)
  6. open https://localhost:6901 in your browser (Chrome works best). Use username kasm_user with password password to log in. You can now develop in the provided desktop environment

Note: Any changes you have been done in your home directory on this desktop are retained and will still be there when you start the container again next time, but you must never assume that the data is safe. Always keep a copy of all your source code (i.e. push to GitHub or the likes). Also, this means if anyone else starts the container, they have access to all your data, unless you delete them, see next section. You must NOT leave any personal data (including logins and password) on the lab PCs when you leave, so it's important you clean up after yourself

Note: If you have installed docker with sudo on linux, you may receive the following error message when logging in Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/auth": dial unix /var/run/docker.sock: connect: permission denied if so, run all docker commands beginning with sudo or add your user to the docker group.

After your work, shut everything down

  1. stop all processes inside the virtual desktop (e.g. with [ctrl-c] in the terminals)
  2. make sure you have saved all your work somewhere, e.g. on github, uploaded to OneDrive (browser), or on Teams (you can have a chat with yourself to keep notes and files!)
  3. If you are on a shared computer (e.g. the lab PCs), make sure you log out of everything and you removed any password files etc.
  4. make sure to stop the container with the command docker compose -f kasm-lcas-jammy.docker-compose.yaml down
  5. If you are on a shared computer (e.g. the lab PCs) and you want to really make sure all your personal information is removed, simply run docker volume rm kasm_lcas_jammy_home_root to wipe all user files. Then, next time the container is restarted, it starts we a blank user directory (So, make sure you know how to quickly recreate your working environment. Again, best practice is to use something like git with https://github.com or https://gitlab.com