Skip to content

Use Network Named License in Container #132

Open
@Nerolf05

Description

@Nerolf05

Hi together, this is a follow on question to #77

Is there an update on that issue how to use a network named license within a container?
I am also trying to use a network named license within a custom Dockerfile on wsl-docker:

# Copyright 2023-2024 The MathWorks, Inc.
ARG MATLAB_RELEASE=R2023b 
ARG MATLAB_INSTALL_LOCATION="/opt/matlab"
ARG ADDITIONAL_PRODUCTS="Statistics_and_Machine_Learning_Toolbox MATLAB_Coder MATLAB_Compiler"
FROM mathworks/matlab:$MATLAB_RELEASE
ARG MATLAB_RELEASE
ARG ADDITIONAL_PRODUCTS
ARG MATLAB_INSTALL_LOCATION

ARG USER_NAME="user_a"
ARG USER_UID=1000
ARG USER_GID=1000
USER root

# Install mpm dependencies
RUN export DEBIAN_FRONTEND=noninteractive \
    && apt-get update \
    && apt-get install --no-install-recommends --yes \
        wget \
        ca-certificates \
    && apt-get install -y git \
    && apt-get clean \
    && apt-get autoremove \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /tmp
USER matlab
RUN wget -q https://www.mathworks.com/mpm/glnxa64/mpm \
    && chmod +x mpm \
    && EXISTING_MATLAB_LOCATION=$(dirname $(dirname $(readlink -f $(which matlab)))) \
    && sudo HOME=${HOME} ./mpm install \
        --destination=${EXISTING_MATLAB_LOCATION} \
        --release=${MATLAB_RELEASE} \
        --products ${ADDITIONAL_PRODUCTS} \
    || (echo "MPM Installation Failure. See below for more information:" && cat /tmp/mathworks_root.log && false) \
    && sudo rm -rf mpm /tmp/mathworks_root.log

COPY net.lic ${MATLAB_INSTALL_LOCATION}/licenses/
ENV MW_DDUX_FORCE_ENABLE=true MW_CONTEXT_TAGS=$MW_CONTEXT_TAGS,MATLAB:TOOLBOXES:DOCKERFILE:V1

USER root
RUN adduser --shell /bin/bash --disabled-password --gecos "" ${USER_NAME} \
    && echo "${USER_NAME} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${USER_NAME} \
    && chmod 0440 /etc/sudoers.d/${USER_NAME}

USER ${USER_NAME}
WORKDIR /home/${USER_NAME}

It builds fine. However when running i receive the following error:

/bin/run.sh: 241: cd: can't cd to /home/user_a/Documents/MATLAB/

Also when trying as explained in Create a Custom MATLAB Container:

docker run -it -rm -u user_a -e MLM_LICENSE_FILE=27000@server.addres mathworks/matlab:r2023b -batch "ver"
docker: Error response from daemon: unable to find user user_a: no matching entries in passwd file.

It seems like i am missing some important point.
Every help appreciated
Best

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions