doc: matlab example - parameterize wrapper, document Individual license workflow#589
doc: matlab example - parameterize wrapper, document Individual license workflow#589llueg wants to merge 6 commits into
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #589 +/- ##
==========================================
- Coverage 77.13% 77.08% -0.05%
==========================================
Files 32 32
Lines 4495 4495
Branches 739 739
==========================================
- Hits 3467 3465 -2
- Misses 726 728 +2
Partials 302 302 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| ARG MATLAB_RELEASE | ||
| ARG MATLAB_USERNAME=matlab-user | ||
| USER root | ||
| RUN sed -i "s/^ubuntu:/${MATLAB_USERNAME}:/" /etc/passwd /etc/group |
There was a problem hiding this comment.
Could something like this technically be done from inside tesseract_api.py at startup? That is, (1) inspect the license file to find out which username it belongs to; (2) manipulate the runtime environment so the username matches? Or maybe even change the username in the release file via text substitution?
(This has a few too many manual steps for my taste, but if it's the best we can do it's what it is.)
There was a problem hiding this comment.
This actually was possible with some tweaks, see the latest changes. We need the root user to rename the relevant files in /etc/passwd. One thing I noticed: tesseract build failed for me with the standard Matlab image as base, since it doesn't have root user by default, so the apt-get in Dockerfile.base failed. I added the root user there now - Claude said this was fine since we change it back at the end anyway, and might be useful for other non-root base images. Let me know what you think. It's weird though that this didn't occur in your original PR on this, since you were also using the default Matlab base image. I checked and 2025b also doesn't have a default root user..
Edit: The root issue will also be fixed in #598 .
There was a problem hiding this comment.
Oh, and you can read the username from the license file, it's in there in hexadecimal (along with the mac address). Changing the mac address at runtime is a little clunky so I would vote to stick with explicit arguments for both, but I can add it if you think it best.
Benchmark ResultsBenchmarks use a no-op Tesseract to measure pure framework overhead. 🚀 0 faster, Notable changes
Full results
|
| as that user. This is required because MATLAB's file-based license | ||
| check picks the `ubuntu` entry out of `/etc/passwd` regardless of the | ||
| actual running UID — renaming it lets the check see the correct user. |
There was a problem hiding this comment.
I don't understand this sentence. Why would it pick out ubuntu? Doesn't it look for <your-username>?
There was a problem hiding this comment.
For some reason, if we don't rename the ubuntu entry, I got an error along the lines of "User ubuntu is not authorized to use this license", regardless of which user name/id I pass to the container.
|
Closing for now, it seems that MathWorks doesn't support using personal licenses from Docker containers, and the solutions here feel too hacky for an official guide. Happy to revisit once there's official support on the MATLAB side. |
Summary
Generalize the
matlab-springmassexample so other users can run itwith their own MATLAB license:
Dockerfile.matlab-baseis now parameterized withMATLAB_RELEASEand
MATLAB_USERNAMEbuild args (was hardcoded).MATLAB Individual license file workflows.
ubuntuuserinside the container — recent MATLAB releases pick
ubuntuout of/etc/passwdfor the file-based license check regardless of theactual running UID. Renaming it to the username your license
authorizes lets the check succeed. Rationale documented in the
Dockerfile comment.
--runtime-argswas used where
--docker-args/--envapply, and payloads weremissing the
{"inputs": ...}wrapper.Test plan
Tested end-to-end with an Individual license. Network license path is
documented based on the previous README but not retested here.
🤖 Generated with Claude Code