|
| 1 | +# Creating a docker image with matlab for kilosort |
| 2 | + |
| 3 | +The goal here is to get a matlab docker image that has the necessary toolboxes to run kilosort. (In order to run matlab within the container, you'll need to provide runtime license information.) |
| 4 | + |
| 5 | +First build the matlab_docker1 image (see the docker1 subdirectory) |
| 6 | + |
| 7 | +Then: |
| 8 | + |
| 9 | +```bash |
| 10 | +docker run -it --rm matlab_docker1 |
| 11 | +``` |
| 12 | + |
| 13 | +Enter your matlab user name and password to start matlab. |
| 14 | + |
| 15 | +Copy the credentials that are inside the container (from a new terminal): |
| 16 | + |
| 17 | +```bash |
| 18 | +docker cp <container-id>:/root/.matlab/MathWorks/MATLAB/LNUCredentials/LNUCreds.info $HOME/container_LNUCreds.info |
| 19 | +``` |
| 20 | + |
| 21 | +where `<container-id>` is the ID of the docker container you are running |
| 22 | + |
| 23 | +Exit the docker image, and restart via: |
| 24 | + |
| 25 | +```bash |
| 26 | +xhost + |
| 27 | +docker run -it --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro --shm-size=512M -v $HOME/container_LNUCreds.info:/root/.matlab/MathWorks/MATLAB/LNUCredentials/LNUCreds.info matlab_docker1 bash |
| 28 | +``` |
| 29 | + |
| 30 | +Then inside the container run |
| 31 | + |
| 32 | +``` |
| 33 | +matlab |
| 34 | +``` |
| 35 | + |
| 36 | +Now you shouldn't need to enter your credentials, and you should get a graphical matlab session! Importantly, however, your credentials are not actually stored in the docker image. |
| 37 | + |
| 38 | +From the GUI click Add-Ons -> Get Add-Ons |
| 39 | + |
| 40 | +Install the required toolboxes. For kilosort, that would be: parallel computing toolbox, signal processing toolbox, Statistics and Machine Learning Toolbox. |
| 41 | + |
| 42 | +I think you may need to install them one at a time. |
| 43 | + |
| 44 | +Then close matlab withing the container (but keep the container running) and commit the image: |
| 45 | + |
| 46 | +```bash |
| 47 | +docker commit <container-id> magland/docker_for_kilosort:0.1.0 |
| 48 | +``` |
| 49 | + |
| 50 | +Now try to create a new container with the committed image: |
| 51 | + |
| 52 | +```bash |
| 53 | +docker run -it magland/docker_for_kilosort:0.1.0 bash |
| 54 | +``` |
| 55 | + |
| 56 | +Then run `matlab` inside that new container. It should ask for the user name and password. And you should have the toolboxes installed! To check this, type `ver` in matlab, and you should see something like: |
| 57 | + |
| 58 | +``` |
| 59 | +>> ver |
| 60 | +----------------------------------------------------------------------------------------------------- |
| 61 | +MATLAB Version: 9.9.0.1592791 (R2020b) Update 5 |
| 62 | +MATLAB License Number: 40764494 |
| 63 | +Operating System: Linux 5.4.0-70-generic #78~18.04.1-Ubuntu SMP Sat Mar 20 14:10:07 UTC 2021 x86_64 |
| 64 | +Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode |
| 65 | +----------------------------------------------------------------------------------------------------- |
| 66 | +MATLAB Version 9.9 (R2020b) |
| 67 | +Parallel Computing Toolbox Version 7.3 (R2020b) |
| 68 | +Signal Processing Toolbox Version 8.5 (R2020b) |
| 69 | +Statistics and Machine Learning Toolbox Version 12.0 (R2020b) |
| 70 | +``` |
| 71 | + |
| 72 | +Finally, push to dockerhub |
| 73 | + |
| 74 | +```bash |
| 75 | +docker push spikeinterface/matlab_for_kilosort:0.1.0 |
| 76 | +``` |
0 commit comments