Import osm data in Docker postgresql

江枫思渺然 提交于 2019-12-09 23:20:15

问题


i am trying to use Docker. So i installed in Docker postgresql image.

Until now, when i imported osm data into postql i used this command:

psql -U postgres mydb

 CREATE EXTENSION postgis;

osm2pgsql -U postgres -d mydb -s -S ./osm_stylesheet /home/ramnikov/Downloads/hessen-latest.osm

How can i do the same inside Docker after this command

$ sudo docker exec -it postgresql sudo -u postgres psql

or before this command ?

Tnx

Andrey


回答1:


You can execute osm2pgsql outside of Docker:

-H|--host Database server host name or socket location.

As well as psql:

-h, --host=HOSTNAME database server host or socket directory

Like this:

psql -h dockerIP -U postgres -d mydb -c 'create extension postgis'

osm2pgsql -H dockerIP -U postgres -d mydb -s -S ./osm_stylesheet /home/ramnikov/Downloads/hessen-latest.osm


来源:https://stackoverflow.com/questions/33827615/import-osm-data-in-docker-postgresql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!