Running Unity 2020.1 in Docker
With every new update, Unity changes their command line interface a bit, and this is still the case with 2020.1. I spent a few hours getting Unity up and running again within Linux Docker, and wanted to document it for those that follow.
Running Unity within Docker is current unsupported, but seems to work if you know the correct incantation of commands. You can read our general approach in this previous article. If you already had Unity 2019.3 running properly in Docker, here are the changes we made to our Docker setup for 2020.1:
Activation now requires a special flag to get the .alf. I followed these steps for activation, generally, but here’s the modified command I ran to get the .alf XML string:
/opt/Unity/Editor/Unity -batchmode -nographics -manualActivation -logFile /dev/stdout -username myemail@gmail.com -password mypassword
When activating, you must not run Unity with xvfb. It will cause a segfault. Use
-nographics
instead:/opt/Unity/Editor/Unity -batchmode -nographics
Once you’ve uploaded the .alf file to Unity’s website, and downloaded the .ulf license file, you can specify the license for subsequent Unity runs using the new flag:
-manualLicenseFile
However, we don’t use this flag, instead we manually inject the license file at the correct path:
Root User:
/root/.local/share/unity3d/Unity/Unity_lic.ulf
Normal User:
/home/username/.local/share/unity3d/Unity/Unity_lic.ulf
If you’re interested in the docker files we use to build our Unity images, here they are. They will, however, need a bit of modification for your own build processes.
unity_clean_unactivated.Dockerfile — builds an Ubuntu image with Unity installed, but unactivated
unity_clean.Dockerfile — consumes the previously built image and activates Unity with a .alf file.
Reach out on Twitter.