使用 Docker 运行
您可以使用官方 Docker 镜像 ghcr.io/maplibre/martin
使用非本地 PostgreSQL
docker run \
-p 3000:3000 \
-e DATABASE_URL=postgres://postgres@postgres.example.org/db \
ghcr.io/maplibre/martin:0.20.2
公开本地文件
您可以使用 -v 标志将本地文件公开给 Docker 容器。
docker run \
-p 3000:3000 \
-v /path/to/local/files:/files \
ghcr.io/maplibre/martin:0.20.2 \
/files
在 Linux 上访问本地 PostgreSQL
如果您在 localhost 上运行 PostgreSQL 实例,则必须更改网络设置以允许 Docker 容器访问 localhost 网络。
对于 Linux,添加 --net=host 标志以访问 localhost PostgreSQL 服务。您不需要使用 -p 导出端口,因为容器已经在使用主机网络。
docker run \
--net=host \
-e DATABASE_URL=postgres://postgres@localhost/db \
ghcr.io/maplibre/martin:0.20.2
在 macOS 上访问本地 PostgreSQL
对于 macOS,使用 host.docker.internal 作为主机名来访问 localhost PostgreSQL 服务。
docker run \
-p 3000:3000 \
-e DATABASE_URL=postgres://postgres@host.docker.internal/db \
ghcr.io/maplibre/martin:0.20.2
在 Windows 上访问本地 PostgreSQL
对于 Windows,使用 docker.for.win.localhost 作为主机名来访问 localhost PostgreSQL 服务。
docker run \
-p 3000:3000 \
-e DATABASE_URL=postgres://postgres@docker.for.win.localhost/db \
ghcr.io/maplibre/martin:0.20.2