Open remorses opened 1 year ago
Hi @remorses. Thanks for pointing this out. This is the first I'd heard of Apple using those port numbers for system services.
For context, the AirPlay Receiver feature in macOS Monterey uses ports 5000 and 7000 when enabled. To disable this feature, you can open System Preferences, go to "Sharing", and uncheck "AirPlay Receiver".
The port exposed by the Docker container can be mapped to a different port on your machine. For example:
$ docker run -d --rm -p 5001:5000 hello-world
(As I mentioned in https://github.com/replicate/cog/issues/1098#issuecomment-1598485762, running Cog without Docker isn't officially supported)
I don't like the precedent of accommodating questionable design choices by Apple, but I think it's worth considering Cog using a different port by default. At the very least, we should update the example usage in our docs to map to a different port.
Currently there is no logs if the port is already used, printing a message like port 5000 already in use
would already be a great improvement
@remorses There shouldn't be a port conflict when running with Docker. Just to confirm, are you proposing that we add a check to cog.server.http
? My expectation is that uvicorn would raise an error if, for example, ControlCenter was already running on port 5000.
uvicorn did not throw any error but you are right that if you use Docker it will probably be Docker to throw this error
@remorses Thanks for confirming that. I just opened https://github.com/replicate/cog/pull/1103 which makes this change.
Mac ControlCenter is using port 5000 and 7000 https://developer.apple.com/forums/thread/682332