Skip to content

Commit e5be558

Browse files
committed
Add dockerfile and instructions
1 parent 30c23b5 commit e5be558

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

Docker_Instructions.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Running NNV on Docker
2+
3+
### Requirements
4+
- Approx 20GB (18.2GB) of memory
5+
- MATLAB license
6+
7+
There are two variables that can be modified to build the docker image (These are to be modified in the Dockerfile)
8+
9+
1. MATLAB release (default R2024b, latest supported)
10+
`ARG MATLAB_RELEASE=R2024b`
11+
12+
2. License server information using the format: port@hostname
13+
`ARG LICENSE_SERVER="27009@licesenceserver.it.vanderbilt.edu"`
14+
15+
Then, proceed to build the Docker image
16+
17+
`docker build . -t nnv`
18+
19+
Run Docker image interactively to use MATLAB and NNV
20+
21+
`docker run -it nnv`
22+
23+
### Acknowledgements
24+
25+
This work is supported in part by AFOSR, DARPA, NSF.
26+
27+
### Contact
28+
29+
For any questions related to NNV in Docker, please add them to the issues or contact [Diego Manzanas Lopez](mailto:diego.manzanas.lopez@vanderbilt.edu).
30+

Dockerfile

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Building from Dockerfile provided by Mathworks
2+
# https://github.com/mathworks-ref-arch/matlab-dockerfile/blob/main/Dockerfile
3+
4+
# Specify MATLAB release
5+
ARG MATLAB_RELEASE=R2024b
6+
7+
# Specify the list of products to install into MATLAB.
8+
ARG MATLAB_PRODUCT_LIST="MATLAB Computer_Vision_Toolbox Control_System_Toolbox Deep_Learning_Toolbox Image_Processing_Toolbox Optimization_Toolbox Parallel_Computing_Toolbox Statistics_and_Machine_Learning_Toolbox Symbolic_Math_Toolbox System_Identification_Toolbox Deep_Learning_Toolbox_Converter_for_ONNX_Model_Format"
9+
10+
# Specify MATLAB Install Location.
11+
ARG MATLAB_INSTALL_LOCATION="/opt/matlab/${MATLAB_RELEASE}"
12+
13+
# Specify license server information using the format: port@hostname
14+
ARG LICENSE_SERVER="27009@licenseserver.it.vanderbilt.edu"
15+
16+
# To check the available matlab-deps images, see: https://hub.docker.com/r/mathworks/matlab-deps
17+
FROM mathworks/matlab-deps:${MATLAB_RELEASE}
18+
19+
# Declare build arguments to use at the current build stage.
20+
ARG MATLAB_RELEASE
21+
ARG MATLAB_PRODUCT_LIST
22+
ARG MATLAB_INSTALL_LOCATION
23+
ARG LICENSE_SERVER
24+
25+
# Install mpm dependencies.
26+
RUN export DEBIAN_FRONTEND=noninteractive \
27+
&& apt-get update \
28+
&& apt-get install --no-install-recommends --yes \
29+
wget \
30+
ca-certificates \
31+
&& apt-get clean \
32+
&& apt-get autoremove \
33+
&& apt-get install -y git \
34+
&& rm -rf /var/lib/apt/lists/*
35+
36+
# Add "matlab" user and grant sudo permission.
37+
RUN adduser --shell /bin/bash --disabled-password --gecos "" matlab \
38+
&& echo "matlab ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/matlab \
39+
&& chmod 0440 /etc/sudoers.d/matlab
40+
41+
# Set user and work directory.
42+
USER matlab
43+
WORKDIR /home/matlab
44+
45+
# Run mpm to install MATLAB in the target location and delete the mpm installation afterwards.
46+
# If mpm fails to install successfully, then print the logfile in the terminal, otherwise clean up.
47+
# Pass in $HOME variable to install support packages into the user's HOME folder.
48+
RUN wget -q https://www.mathworks.com/mpm/glnxa64/mpm \
49+
&& chmod +x mpm \
50+
&& sudo HOME=${HOME} ./mpm install \
51+
--release=${MATLAB_RELEASE} \
52+
--destination=${MATLAB_INSTALL_LOCATION} \
53+
--products ${MATLAB_PRODUCT_LIST} \
54+
|| (echo "MPM Installation Failure. See below for more information:" && cat /tmp/mathworks_root.log && false) \
55+
&& sudo rm -rf mpm /tmp/mathworks_root.log \
56+
&& sudo ln -s ${MATLAB_INSTALL_LOCATION}/bin/matlab /usr/local/bin/matlab
57+
58+
59+
ENV MLM_LICENSE_FILE=$LICENSE_SERVER
60+
61+
# Install nnv
62+
RUN git clone https://github.com/verivital/nnv.git
63+
64+
WORKDIR nnv
65+
66+
RUN matlab -nodisplay -r "cd code/nnv/; install; exit()"

0 commit comments

Comments
 (0)