简体   繁体   English

如何连接到 OpenMapTiles Docker Postgres DB

[英]How to connect to OpenMapTiles Docker Postgres DB

I am currently playing around with openmaptiles ( https://github.com/openmaptiles/openmaptiles ) and I'd like to figure out how to import my own data into the resulting mbtiles.我目前正在使用 openmaptiles ( https://github.com/openmaptiles/openmaptiles ),我想弄清楚如何将我自己的数据导入到生成的 mbtiles 中。 But first I'd like to look at how the postgres database it is using is structured.但首先我想看看它使用的 postgres 数据库是如何构建的。 I just can't figure out how I can connect to the postgres database using my GUI tool I have running locally.我只是不知道如何使用我在本地运行的 GUI 工具连接到 postgres 数据库。

I start postgres using the command provided on the help page: docker-compose up -d postgres .我使用帮助页面上提供的命令启动 postgres: docker-compose up -d postgres Is it just not visible to outside of the docker container (I am also very new to docker)?它是不是在 docker 容器外部不可见(我对 docker 也很陌生)? And is there a way to make it visible to my local system?有没有办法让它对我的本地系统可见?

docker-compose up -d postgres refers to this part of the docker-compose.yaml file: docker-compose up -d postgres指的是docker-compose.yaml文件的这一部分:

services:
  postgres:
    image: "openmaptiles/postgis:2.9"
    volumes:
    - pgdata:/var/lib/postgresql/data
    networks:
    - postgres_conn
    ports:
     - "5432"
env_file: .env

...

As you can see in the ports: section, there is no container - host port mapping here.正如您在ports:部分中看到的,这里没有容器 - 主机端口映射。 To access this postgres database from your host try using "5432:5432" .要从您的主机访问此 postgres 数据库,请尝试使用"5432:5432" (notice that if you're already using this port on the host, you will have to pick an available one). (请注意,如果您已经在主机上使用此端口,则必须选择一个可用的端口)。

For more information on the docker-compose file reference and ports, check the docs .有关 docker-compose 文件参考和端口的更多信息,请查看文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM