I currently have the same problem with Defold v1.12.4. I’m using Kubuntu 24.04. When I try to run Defold (standalone executable) from terminal with DM_SERVICE_PORT=8001 ./Defold or with export DM_SERVICE_PORT=8001 + ./Defold, the editor still runs in random port:
util.http-server - {:line 380, :msg "Http server running", :local-url "http://localhost:41785"}
For the record if someone has the same issue I had: --port argument seems to work and changes the port of the HTTP server (documented in here: Automating the Defold editor with HTTP). For example, running ./Defold --port 7777 works for me and the port is changed to 7777. Maybe DM_SERVICE_PORT is not correct parameter in my use case.