Building Unity Headless Docker Image
✍ Last Updated : September 19, 2022
🚪 Prequisite Knowledge (Optional)
‣
Unity Project Build Process
- [Containerization / Docker](Containerization Docker 2e0ce73ff63b419d9e2782d79c4cc440.md)
- [Build Docker Image for Minikube](Build Docker Image for Minikube e00be467a95f48deaa1a2c87088468eb.md)
❓ Key Question / Problem / Issue
How to build
✅ Expected Output/Definition of Done
Define what information you really need and the definition of done
Clear guideline on how to create Unity Headless Docker Image
🎁 Resulting Solution
Write writing results below
Build Headless Docker Image
Kubernetes uses a Docker image to run your headless build, to create your image we already created a directory called SampleHeadless inside the project to help you build your image.
now copy your build files into /SampleHeadless/build-files
the directory should look more or less like this:
- SampleHeadless
- build-files
- linuxBuild_Data
- .gitkeep
- linuxBuild.x86_64
- UnityPlayer.so
- build-files
open another terminal or command prompt and cd to the SampleHeadless directory
run
& minikube -p agones docker-env | Invoke-Expression
docker build -t unity-headless .
result
Sending build context to Docker daemon 69.81MB
Step 1/7 : FROM ubuntu:bionic
---> 8d5df41c547b
Step 2/7 : ARG DEBIAN_FRONTEND=noninteractive
---> Running in 2ab7180ebd21
Removing intermediate container 2ab7180ebd21
---> 53883ce1e344
Step 3/7 : ARG DOCKER_VERSION=17.06.0-ce
---> Running in 7622e125d38c
Removing intermediate container 7622e125d38c
---> 1cc2f345bc69
Step 4/7 : COPY build-files/ /root/build/
---> e49fac17d54d
Step 5/7 : COPY entrypoint.sh /entrypoint.sh
---> 9bdc5106fb27
Step 6/7 : WORKDIR /root/
---> Running in 92467f9a5571
Removing intermediate container 92467f9a5571
---> 8f878d9857ac
Step 7/7 : ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
---> Running in 29620b2561e9
Removing intermediate container 29620b2561e9
---> 49faf80e3f64
Successfully built 49faf80e3f64
Successfully tagged unity-headless:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host.
All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
to check your image, on the same terminal
run
docker image ls
result
unity-headless latest 49faf80e3f64 15 minutes ago 133MB
gcr.io/agones-images/agones-allocator 1.25.0 90209bbb8134 13 days ago 66.3MB
gcr.io/agones-images/agones-sdk 1.25.0 07d53a7b8dae 13 days ago 63.7MB
gcr.io/agones-images/agones-ping 1.25.0 7c30bcd998d0 13 days ago 20.5MB
gcr.io/agones-images/agones-controller 1.25.0 f9f714de0e2e 13 days ago 67MB
ubuntu bionic 8d5df41c547b 2 weeks ago 63.1MB
k8s.gcr.io/kube-apiserver v1.22.12 d922296a8b85 4 weeks ago 128MB
k8s.gcr.io/kube-controller-manager v1.22.12 f5ef4d6e36ee 4 weeks ago 122MB
k8s.gcr.io/kube-proxy v1.22.12 761817698b62 4 weeks ago 104MB
k8s.gcr.io/kube-scheduler v1.22.12 5ee90014579c 4 weeks ago 52.7MB
k8s.gcr.io/metrics-server/metrics-server <none> e57a417f15d3 6 months ago 68.8MB
k8s.gcr.io/etcd 3.5.0-0 004811815584 14 months ago 295MB
k8s.gcr.io/coredns/coredns v1.8.4 8d147537fb7d 14 months ago 47.6MB
gcr.io/k8s-minikube/storage-provisioner v5 6e38f40d628d 16 months ago 31.5MB
k8s.gcr.io/pause 3.5 ed210e3e4a5b 17 months ago 683kB
the unity-headless image should be listed there
Docker Run
docker run —name=test-unity-headless test-headless
Testing Port is opened & received
netstat -tulpn
No Comments