The server listens on 127.0.0.1 port 11434. A container, a virtual machine or another host on the network gets connection refused, which is frequently misread as the service being down. Setting the OLLAMA_HOST environment variable to 0.0.0.0 with the port makes it listen on all interfaces, and the variable has to be set for the server process, not for the client.
On macOS the app runs as a launch agent and on Linux typically as a systemd unit, so exporting the variable in a shell does not affect the already-running server. Set it in the service environment and restart.
Do this deliberately. The API has no authentication of any kind, so binding to all interfaces exposes model execution and the full model list to anything that can reach the port. Put it behind a reverse proxy that terminates TLS and authenticates, or restrict it at the firewall, rather than exposing it directly. The same variable, pointing at a remote address, is how the CLI and client libraries target a non-local server.