Skip to content
Snippets Groups Projects
Select Git revision
  • b21fbe2a6cafacf06392f6ea52c6982f342ea567
  • 2023 default protected
2 results

scikit-image-0.19.3-foss-2022a.eb

Blame
  • README.md 5.61 KiB

    Singularity + Docker + Jupyter

    In this recipe, you will learn how to create your own container-based environment that you can use at home and on the supercomputer. It is compatible with windows as well as Linux and MacOS, however only if your host is of X86 architecture (new Macs might pose a problem).
    It is composed of the following steps: 0. Install docker

    1. Create a docker container that contains the environment
    2. Run the docker container to serve a local jupyter server and to execute programs
    3. Export the docker container for singularity. (Does this work on WSL?)
    4. Recreate the environment on the supercomputers

    #Install docker This step depends on the OS you use. Please follow the instructions on the docker web page. After that you should be able to start a simple docker container:

    docker run -it ubuntu bash

    You can leave the container by typing exit.

    On Windows, it is highly recommended to install the Windows Subsystem Linux. This will provide you with the WSL console, where you have a linux-like environment. Please check that you can execute the commands above.

    For convenience, we recommend enabling the option to run docker without the sudo command. On Linux, you can follow this procedure. Otherwise, you will need to adjust the scripts in the docker subdirectory.

    Create a docker image and container

    In this step, you will create a custom docker image and a docker container that contains the environment. First clone this repository, and cd into it. Please pick a good path for that. You might keep this repository for a long time. Here we assume, it is /path/to.

    cd /path/to
    git clone https://gitlab.jsc.fz-juelich.de/AI_Recipe_Book/recipes/singularity_docker_jupyter
    cd singularity_docker_jupyter

    Everything related to the docker image is in the subdir docker. The rules to build the docker image are found in the Dockerfile. Look inside, you will see that we start from a plain ubuntu-image, install Python with apt-get and install Jupyter with pip. Build the docker container with the following commands

    cd docker
    ./build.sh

    The build script will build the container and tag it with singularity_docker_jupyter. Once the container is build, you can run the jupyter server with the script run.sh:

    ./run_jupyter.sh

    The run script will start a docker container hosting a jupyter server that you can access by navigating to http://localhost:8889/. It will be restarted automatically when your system reboots or the container exits. In order to permanently remove it, execute

    docker rm -f singularity_docker_jupyter_cont

    We also have created small scripts to run commands and an interactive shell in the container. Execute

    ./run_bash_in_container.sh

    to run an interactive bash shell inside of the container. Exit it by typing exit. Executing commands is possible with the script run_command_in_container.sh. If you execute