This guide provides instructions for building and running the MostroP2P application using Docker and Docker Compose.
Ensure you have Docker and Docker Compose installed on your machine. You can download Docker from here and Docker Compose from here.
You need to have a LND node running locally. We recommend using Polar for this.
The compose.yml sets up the following services:
mostro: the MostroP2P service (standard build usingdocker/Dockerfile)nostr-relay: the Nostr relay
StartOS users: install Mostro from the StartOS marketplace (one-click).
To build and run the Docker container using Docker Compose, follow these steps:
-
Clone the repository:
git clone https://github.com/MostroP2P/mostro.git
-
Ensure you have
settings.toml(and, after runningmake docker-build, the LND cert and macaroon inconfig/lnd/) in aconfigdirectory. Thecompose.ymlvolumessection mounts./config(relative to thedocker/directory) to/configin the container. On first run you only needsettings.toml; Mostro createsmostro.dbautomatically. Create the config dir and copy the template as follows:cd docker mkdir -p config cp ../settings.tpl.toml config/settings.tomlDon't forget to edit
lnd_grpc_host,nsec_privkeyandrelaysfields in theconfig/settings.tomlfile. Note that paths insettings.tomlrefer to paths inside the container, so use/config/lnd/tls.certand/config/lnd/admin.macaroonfor the LND certificate and macaroon files (these will be copied there bymake docker-build). -
Build the docker image. You need to provide the
LND_CERT_FILEandLND_MACAROON_FILEenvironment variables with the paths to your LND TLS certificate and macaroon files. These files will be copied to thedocker/config/lnddirectory by themake docker-buildcommand. The build process will validate that these variables are set and that the files exist before proceeding.Linux/macOS:
LND_CERT_FILE=~/.polar/networks/1/volumes/lnd/alice/tls.cert \ LND_MACAROON_FILE=~/.polar/networks/1/volumes/lnd/alice/data/chain/bitcoin/regtest/admin.macaroon \ make docker-build
Windows PowerShell:
$env:LND_CERT_FILE="C:\Users\YourUser\.polar\networks\1\volumes\lnd\alice\tls.cert" $env:LND_MACAROON_FILE="C:\Users\YourUser\.polar\networks\1\volumes\lnd\alice\data\chain\bitcoin\regtest\admin.macaroon" make docker-build
Alternative: You can export the variables for your session:
export LND_CERT_FILE=~/.polar/networks/1/volumes/lnd/alice/tls.cert export LND_MACAROON_FILE=~/.polar/networks/1/volumes/lnd/alice/data/chain/bitcoin/regtest/admin.macaroon make docker-build
-
[Optional] Set the
MOSTRO_RELAY_LOCAL_PORTenvironment variable to the port you want to use for the local relay (defaults to 7000 if not set). This can be set before runningmake docker-up:export MOSTRO_RELAY_LOCAL_PORT=7000 make docker-upOr set the variable on one line before
make docker-up:MOSTRO_RELAY_LOCAL_PORT=7000 make docker-up
-
Run the docker compose file:
make docker-up
You can run the plain Mostro image without building locally. Use a single config directory on the host and mount it at /config in the container. Paths in settings.toml are inside the container, so use /config/... for certs, macaroon, and database.
-
Create a config directory and get the settings template:
Option A — download the template (from the settings.tpl.toml repo file):
mkdir -p ~/mostro-config/lnd curl -sL https://raw.githubusercontent.com/MostroP2P/mostro/main/settings.tpl.toml -o ~/mostro-config/settings.toml
Option B — use the entrypoint default: run the container once with an empty config dir; the entrypoint copies a default
settings.toml(from the image, built fromsettings.tpl.toml) into/config. Stop the container, edit the file on the host (e.g.~/mostro-config/settings.toml), then start the container again. -
Copy your LND TLS cert and macaroon into the config dir (so they appear at
/config/lnd/in the container):cp /path/to/your/tls.cert ~/mostro-config/lnd/tls.cert cp /path/to/your/admin.macaroon ~/mostro-config/lnd/admin.macaroon
-
Edit
~/mostro-config/settings.toml: setnsec_privkey,relays, and for Docker setlnd_cert_file/lnd_macaroon_fileto/config/lnd/...,lnd_grpc_host(e.g.https://host.docker.internal:10009), and[database]url = "sqlite:///config/mostro.db". -
Run the container. On Linux, add
--add-host=host.docker.internal:host-gatewayso the container can reach LND on the host:docker run -d --name mostro \ --add-host=host.docker.internal:host-gateway \ -v ~/mostro-config:/config \ mostrop2p/mostro:latestIf you used Option B (empty config dir), edit the copied
settings.tomland restart. Mostro createsmostro.dbat startup when missing. -
Check logs:
docker logs -f mostro.
Steps to run the plain Mostro image on a VPS (no repo clone; image from Docker Hub).
-
Install Docker on the VPS (e.g. Docker Engine).
-
Create a config directory (e.g.
/opt/mostroor~/mostro-config):mkdir -p /opt/mostro/lnd
-
Get the settings template into that directory as
settings.toml:- Either run the container once with an empty config dir; the entrypoint will copy the default template to
/config/settings.toml. Stop the container, then edit the file on the host. - Or download the template and copy it:
curl -sL https://raw.githubusercontent.com/MostroP2P/mostro/main/settings.tpl.toml -o /opt/mostro/settings.toml
- Either run the container once with an empty config dir; the entrypoint will copy the default template to
-
Put LND files in the config dir so they appear at
/config/lnd/in the container:cp /path/to/lnd/tls.cert /opt/mostro/lnd/tls.cert cp /path/to/lnd/admin.macaroon /opt/mostro/lnd/admin.macaroon
(If LND is on another host, you only need the cert and macaroon copied here; point
lnd_grpc_hostat that host in step 5.) -
Edit
/opt/mostro/settings.toml:[lightning]:lnd_cert_file = '/config/lnd/tls.cert',lnd_macaroon_file = '/config/lnd/admin.macaroon',lnd_grpc_host= your LND gRPC URL (e.g.https://host.docker.internal:10009if LND is on the same VPS, orhttps://your-lnd-host:10009if remote).[database]:url = "sqlite:///config/mostro.db".[nostr]: setnsec_privkeyandrelays(e.g. public relays).
-
Run the container:
- If LND is on the same VPS (e.g. another container or process), so the container must reach the host:
docker run -d --name mostro \ --restart unless-stopped \ --add-host=host.docker.internal:host-gateway \ -v /opt/mostro:/config \ mostrop2p/mostro:latest
- If LND is on a different machine, omit
--add-hostand use that machine’s hostname or IP inlnd_grpc_host:
docker run -d --name mostro \ --restart unless-stopped \ -v /opt/mostro:/config \ mostrop2p/mostro:latest
-
Check logs:
docker logs -f mostro. Mostro will createmostro.dbin the config dir on first run. -
Optional: Pin the image to a version, e.g.
mostrop2p/mostro:v0.16.2instead of:latest.
To stop the Docker container, run:
make docker-downmake docker-build- Build the standard mostro service (requiresLND_CERT_FILEandLND_MACAROON_FILEenvironment variables)make docker-up- Start all services (mostro + nostr-relay)make docker-down- Stop all servicesmake docker-relay-up- Start only the Nostr relaymake docker-build-startos- Build the StartOS variant of mostro service
See ENV_VARIABLES.md for details about required environment variables.
-
Run the following command to start the Nostr relay:
make docker-relay-up
-
Stop the Nostr relay:
make docker-down