Skip to content

docker-compose.yml: network_mode: host doesn't work on macOS #28

@ttilberg

Description

@ttilberg

The generated docker-compose.yml uses network_mode: host for Prometheus, which doesn't work on macOS Docker Desktop.

On Mac, Docker runs in a Linux VM, so "host" refers to the VM's network, not the Mac's localhost.

This causes exceptions when trying to navigate to "uptime" or "status":

Prometheus::ApiClient::Client::RequestError (Failed to open TCP connection to localhost:9090 (Connection refused))

I fixed this by replacing network_mode: host with a port mapping in the docker compose file:

prometheus:
  image: prom/prometheus:v3.4.1
  container_name: uptime-prometheus
  ports:
    - "9090:9090"
  volumes:
    # ...

If the network_mode: host config is important for reasons I haven't yet discovered, maybe a comment in the file for Docker Desktop users (macos/windows) could be helpful to help guide macos developers.

And/or a mention in the readme about some of these macos environment differences I've been finding.

Environment:

  • macOS (Docker Desktop)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions