dockerでunityを動かしたく調べ始める。
UnityEditorのバージョン管理をしたい
https://qiita.com/Sashimimochi/items/06c136487b8150e35ed0
最近流行りのDockerを使ってUnityを動かせないかと思いました。結論から言うとおすすめしません。それでも、供養の意味も込めて検討記録ということで長くはなりますが、それでもいいよという心優しい方はお付き合いください。
nenadg/docker-unity3d
https://github.com/nenadg/docker-unity3d
条件
Unityをhostに導入するのは嫌。
dockerの外でcompileするのは嫌。
dockerの中でcompileするのはOK.
例
gableroux/unity3d
https://hub.docker.com/r/gableroux/unity3d/
unity3d
https://gitlab.com/gableroux/unity3d
$ docker run -it --rm -v "$(pwd):/root/project" gableroux/unity3d:latest xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' /opt/Unity/Editor/Unity -projectPath /root/project
Unable to find image 'gableroux/unity3d:latest' locally
latest: Pulling from gableroux/unity3d
6abc03819f3e: Pulling fs layer
05731e63f211: Pulling fs layer
0bd67c50d6be: Pulling fs layer
e59bcdf9f569: Waiting
b71d75459548: Waiting
ea0a10bb716a: Waiting
docker: error pulling image configuration: Get https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/blobs/sha256/44/44cfb41a0d6ce87f3bf9019a7ed4b40aa20c23d390f0515756c8d07200623b5a/data?verify=1559100714-PcoiRlJ4gKyKppTu7hxHitXjGqs%3D: Service Unavailable.
See 'docker run --help'.
「-v "$(pwd):/root/project"」 を外すと作業を始めた。意味があるかどうかは後で検討。
$ docker run -it --rm gableroux/unity3d:latest xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' /opt/Unity/Editor/Unity -projectPath /root/project
Unable to find image 'gableroux/unity3d:latest' locally
latest: Pulling from gableroux/unity3d
6abc03819f3e: Pull complete
05731e63f211: Pull complete
0bd67c50d6be: Pull complete
e59bcdf9f569: Pull complete
b71d75459548: Pull complete
ea0a10bb716a: Pull complete
Digest: sha256:b84f59091450b89314591dd9e1f51f6aceaf34994b82a7f282b32612b4c36837
Status: Downloaded newer image for gableroux/unity3d:latest
ここでプロンプトが出ずに止まった。
/bin/bashの指定がないため当たり前かも。
-vの意味を調べる。
やる前に調べろって? ごめんなさい。 DoCAP。
Dockerのすべてが5分でわかるまとめ!(コマンド一覧付き)
https://paiza.hatenablog.com/entry/docker_intro
--volume , -v Bind mount a volume
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1f80fb69bfa2 gableroux/unity3d:latest "xvfb-run --auto-ser…" 7 minutes ago Up 7 minutes priceless_ramanujan
2e7d55f97935 kaizenjapan/100pon "/usr/bin/tini -- /b…" 4 months ago Up 4 months mystifying_roentgen
KM-S10:~ administrator$ docker stop 1f80fb69bfa2
1f80fb69bfa2
$ docker run -it --rm -v "/root/project" gableroux/unity3d:latest xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' /opt/Unity/Editor/Unity -projectPath /root/project
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
54aa8c924989 gableroux/unity3d:latest "xvfb-run --auto-ser…" About a minute ago Up About a minute sleepy_rosalind
2e7d55f97935 kaizenjapan/100pon "/usr/bin/tini -- /b…" 4 months ago Up 4 months mystifying_roentgen