Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Build headless linux for docker on mac m2

Discussion in 'macOS' started by voidnoise, Feb 20, 2023.

  1. voidnoise

    voidnoise

    Joined:
    Feb 1, 2016
    Posts:
    4
    Hi,

    I am struggling to get linux builds (on mac) to run in docker (again on the mac). I have identified that last printout before the fault;

    Initialize engine version: 2022.2.5f1 (551d45108343)
    [Subsystems] Discovering subsystems at path /app/Server_Data/UnitySubsystems
    Forcing GfxDevice: Null
    GfxDevice: creating device client; threaded=0; jobified=0
    NullGfxDevice:
    Version: NULL 1.0 [1.0]
    Renderer: Null Device
    Vendor: Unity Technologies
    Begin MonoManager ReloadAssembly
    * Assertion: should not be reached at tramp-amd64.c:605
    Caught fatal signal - signo:6 code:-6 errno:0 addr:0x271100000001

    Looking around online I think it could be due to the mac arm arm chipset not working well with docker to support the virtualisation. Has anyone managed to successfully build for linux and then run in a docker container all on a mac m1/m2? And if so, what was your method?
     
  2. unmaxim

    unmaxim

    Joined:
    Jul 25, 2013
    Posts:
    6
    same here. did someone have find any solution or workaround? share please
     
  3. voidnoise

    voidnoise

    Joined:
    Feb 1, 2016
    Posts:
    4
    Unfortunately not. I gave up trying and just worked with a different setup.
     
  4. aallbright

    aallbright

    Joined:
    Sep 3, 2020
    Posts:
    5
    I'm on an M2 macbook pro. I've been able to get a dedicated linux server build running inside of an ubuntu image. Let me explain what I had to do.

    Before building a Linux Dedicated Server I did have to update Scripting Backend to the value of IL2CPP (not Mono).
    Screenshot 2023-11-21 at 6.51.41 PM.png

    I then built the Linux Dedicated Server using these settings (I flipped on "Development Build" but this is not necessary (Edit: after some testing it is actually necessary)). I name my Linux Dedicated Server "tanks.game-server.x86_64"
    Screenshot 2023-11-21 at 6.51.51 PM.png
    Screenshot 2023-11-21 at 7.02.14 PM.png


    I built what I call the "Linux Game Server" into a folder called "game-server-build." In order to test linux game server binary without having to author a Dockerfile, I simply use the "ubuntu:latest" image.

    docker run -it --rm --workdir /root/game-server --platform linux/amd64 --volume $(pwd)/game-server-build:/root/game-server ubuntu:latest bash

    I am then able to run the linux game server binary from inside the ubuntu:latest image

    ./tanks.game-server.x86_64

    Screenshot 2023-11-21 at 7.09.34 PM.png

    Running the game this way is a little weird. I can't simply press "command + c" to exit the process. I have run "command + z" to push the process (job) into the background and then "kill -9 %1" to kill the process (job).

    Screenshot 2023-11-21 at 7.05.04 PM.png

    Hope this helps someone. If it does help you feel free to let me know!

    Docker Desktop: 4.25.2
    Docker Engine: 24.0.6
    Macbook Pro
    Chip: Apple M2 Max
     
    Last edited: Nov 23, 2023