# WSL set-up resource
###### tags: `Notes`
Collections of stuff from the web....
By Hao-Ting Wang
[toc]
## Terminal emulator
[Existing tutorial](https://medium.com/@bhupathy/install-terminator-on-windows-with-wsl-2826591d2156)
## Jupyter lab
Follow steps here:
[Jupyter Notebook in Windows subsystem for Linux (WSL)](https://medium.com/@sayanghosh_49221/jupyter-notebook-in-windows-subsystem-for-linux-wsl-f075f7ec8691)
and then
`pip3 install jupyterlab`
Copy the address in your prefered browser to access. There's no need to install any browsers in WSL
## Docker
[Setting Up Docker for Windows and WSL to Work Flawlessly — Nick Janetakis](https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly)
A few things to keep in mind:
* Docker can only mount file path on the local hardrive where you have admin permission.
* The output has to be on the local drive.
* The output cannot be kept on the WSL home directory.
### Windows 10 - cleaning docker disk image
Some bugs on Windows version -
`docker system prune -all` doesn't clean up space
Reference to this solution: https://github.com/docker/for-win/issues/1042
```shell
docker system prune -a -f
net stop com.docker.service
taskkill /F /IM "Docker Desktop.exe"
stop-vm DockerDesktopVM
Optimize-VHD -Path "C:\Path\to\DockerDesktop.vhdx" -Mode Full
start-vm DockerDesktopVM
start "C:\Program Files\Docker\Docker\Docker Desktop.exe"
net start com.docker.service
```
### Neurodocker
I use a docker environment for neuroimaging software.
**This is not important. At all.**
Build image by piping Dockerfile to `docker build - < Dockerfile`
```bash
# generate_neurodocker.sh
docker run --rm kaczmarj/neurodocker:0.6.0 generate docker \
--base debian:stretch --pkg-manager apt \
--install git vim \
--ants version=2.2.0 method=binaries \
--afni version=latest method=binaries \
--freesurfer version=6.0.0 method=binaries -e FS_LICENSE=~/fs_license.txt \
--fsl version=5.0.11 method=binaries \
--miniconda conda_install="python3.6 traits" create_env=neuro \
--miniconda use_env=neuro \
conda_install="jupyter jupyterlab jupyter_contrib_nbextensions nbformat scikit-learn matplotlib seaborn" \
pip_install="nipype nilearn" \
activate=True \
--run 'mkdir -p ~/.jupyter && echo c.NotebookApp.ip = \"0.0.0.0\" > ~/.jupyter/jupyter_notebook_config.py' \
> Dockerfile
docker build --tag my_neurodocker .
```
## How to Mount Windows Network Drives in WSL
### Mount a Drive Until Logoff
Note the letter of the network drive that you would like to map in WSL. We will use `M:` in this example.
Create a new folder for that drive letter under `/mnt` if it does not already exist. (ex: `mkdir /mnt/m`)
Mount the drive with `sudo mount -t drvfs M: /mnt/m`
### Mount Drives in a Persistent Manner
Ensure the folder exists for the mount target (e.g. `/mnt/m`)
Open `/etc/fstab` and add a line such as the following:
`M: /mnt/m drvfs defaults 0 0`
Reload the `fstab` file with `sudo mount -a`