Installing Unity 2017.1.0f2 In Docker Container
I am attempting to create a Docker container to handle my build pipeline for Unity.
In my Docker container I am running Ubuntu 16.04. Everything seems to work just fine until I actually try to run the installer. I am not fully understanding what the logs are telling me.
Any advice is greatly appreciated! Thank you in advance. :)
Here is the output from my Docker container build - please let me know if there are any other logs I can attach or look at to help solve the issue:
Step 16/20 : ENV UNITY3D_VERSION "2018.1.0f2"
---> Running in d0121721b1a4
Removing intermediate container d0121721b1a4
---> 88cd7299986d
Step 17/20 : RUN apt-get install -qq -y lib32gcc1 lib32stdc++6 libasound2 libc6 libc6-i386 libcairo2 libcap2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libfreetype6 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libgl1-mesa-glx libglib2.0-0 libglu1-mesa libgtk2.0-0 libnspr4 libnss3 libpango1.0-0 libstdc++6 libx11-6 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxtst6 zlib1g debconf npm libgtk2.0-0 libsoup2.4-1 libarchive13 && apt-get clean && rm -rf /var/lib/apt/lists/*
---> Running in 2b98d4a6888a
Removing intermediate container 2b98d4a6888a
---> b339898a8ba4
Step 18/20 : ADD https://beta.unity3d.com/download/170f0691b973/UnitySetup-${UNITY3D_VERSION} /opt/Unity
Downloading [==================================================>] 273.9kB/273.9kB
---> 263e84cac921
Step 19/20 : RUN chmod +x /opt/Unity
---> Running in 02030e358cf4
Removing intermediate container 02030e358cf4
---> 168586f4a370
Step 20/20 : RUN yes | /opt/Unity --unattended --install-location /opt/Unity-${UNITY3D_VERSION} && rm -rf /tmp/* /var/tmp/*
---> Running in cbe8264ccc3e
UNITY TERMS OF SERVICE
Do you accept the terms of the License Agreement? (y/n)
Beginning unattended installation to '/opt/Unity-2018.1.0f2', downloading packages to '<temporary location>'
Error 404 getting 'https://netstorage.unity3d.com/unity/170f0691b973/unity-2018.1.0f2-linux.ini'
Download of 'https://netstorage.unity3d.com/unity/170f0691b973/unity-2018.1.0f2-linux.ini' failed
Error 404 getting 'https://download.unity3d.com/download_unity/170f0691b973/unity-2018.1.0f2-linux.ini'
Download of 'https://download.unity3d.com/download_unity/170f0691b973/unity-2018.1.0f2-linux.ini' failed
Successfully downloaded https://beta.unity3d.com/download/170f0691b973/unity-2018.1.0f2-linux.ini => /tmp/.UW3GKZ
Selecting Unity
Selecting Documentation
Selecting StandardAssets
Required installation size: Total space required: 3.72 GB
Available space: Space available: 6.93 GB
Unable to write to install location '/opt/Unity-2018.1.0f2', aborting
The command '/bin/sh -c yes | /opt/Unity --unattended --install-location /opt/Unity-${UNITY3D_VERSION} && rm -rf /tmp/* /var/tmp/*' returned a non-zero code: 1
Answer by GabLeRoux · Jun 12, 2018 at 06:56 PM
Hi there, I don't know where you found your docker base image, but I think it's not compatible with the version you're trying. I went the docker way too with Unity and I was able to make it work. I decided to go the Open Source way so anyone can benefit from it.
You can find the docker image project here:
https://gitlab.com/gableroux/unity3d/
The docker image on docker hub:
https://hub.docker.com/r/gableroux/unity3d
Here's an example project using it with gitlab-ci which confirms the above works:
https://gitlab.com/gableroux/unity3d-gitlab-ci-example/
At the time of writing this answer, the project is currently built on 2017.2.0b11, there is an open issue to support the new way to install Unity on linux:
https://gitlab.com/gableroux/unity3d/issues/8
And thanks to MattDahEpic, here's an open merge request I plan to merge soon which should make 2018 and above versions work:
https://gitlab.com/gableroux/unity3d/merge_requests/3
This project is still in active development, but I plan to build docker images of all available Unity versions for Linux:
https://gitlab.com/gableroux/unity3d/issues/3
Feel free to fork the projects and contribute!
Hi GabLeRoux, thanks for answering! I am actually basing my Unity build pipeline partially off of the Docker container you made. It has been a great starting point for my $$anonymous$$m's build pipeline requirements. I am making a Ubuntu:16.04 based image, and more or less am doing the same stuff yours does when it comes to the Unity install portion. The steps prior involve installing and configuring an Android development environment.
I believe the issue is somewhere in the following lines, but I'm having a difficult time debugging what it might be. I'm a little new to Docker.
ADD https://beta.unity3d.com/download/170f0691b973/UnitySetup-${UNITY3D_VERSION} /opt/Unity
RUN chmod +x /opt/Unity
RUN sudo mkdir /opt/Unity-${UNITY3D_VERSION} && \
yes | /opt/Unity --unattended --install-location /opt/Unity-${UNITY3D_VERSION} && \
rm -rf /tmp/* /var/tmp/*
Is there anything obviously wrong with those commands?
Oh I see. I did not work with android and docker at the same time yet and I'm not quite sure about the /opt/Unity --unattended --install-location
parameters above.
Concerning the error you get "Unable to write to install location '/opt/Unity-2018.1.0f2', aborting", it looks like Unity needs some more rights. $$anonymous$$aybe you can try it locally by building the image until the RUN sudo mkdir /opt/Unity-${UNITY3D_VERSION}
(remove everything after that), then run a shell inside and see if you can do anything from there (using a shell inside the docker image), ex;
docker run -it --rm name_of_your/unity3d-image bash
Or you could bypass your problem by using an already working docker image for the Unity related things and then use an already provisioned java image for the android building part? I know there's a way we can generate a gradle project with Unity a bit like iOS does by generating an xcode project by default, I'm just not sure we can do it without java installed. You could grab that gradle project from a pipeline step and then use something like https://github.com/$$anonymous$$drunner/docker-android-sdk in a different build step, reusing previous artifact.
Yeah the Android SD$$anonymous$$ install is pretty straightforward, and mostly setting up paths for the SD$$anonymous$$ so I can tell Unity where to find them when it builds. Our process is exporting the Unity project then running the gradle wrapper on the exported project, and finally running the gradle build for signing and release configuration.
I think I actually might have figured out what was going on, thanks for asking about the install flags. I found that deep in the Linux Editor update post here.
You'll note that $$anonymous$$e is missing the ={path}, I was just giving it the incorrect parameters for my Unity directory.
I plan on posting an open source version of my additions off of a forked version of what you have done, my requirements are a little different but the additions I make might be handy for yours to include. I will eventually be working in iOS along with what we're currently doing (PC, $$anonymous$$ac, Android). I will eventually be working on test automation with Poco utilizing a Docker container.
We are also using GitLab CI tools, so our two projects sync up decently well.
Your answer
Follow this Question
Related Questions
What are Unity's default emscripten arguments during build? 0 Answers
Get Unity Running on Linux 0 Answers
Multiple shader recompiles for each scene 0 Answers
How to change mesh.vertices in a during build project time? 1 Answer
Any way to exclude BuildConfig.java from unity-android-resources project via Gradle? 1 Answer