Import osm data in Docker postgresql

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

  • Redis in Docker container with custom redis.conf file not attaching
  • TCP Proxy: Hold connections while backend is unavailable
  • Got an error when running rake db:create in Docker
  • Docker: execute a program that requires tty
  • How to obtain container Ip from another container?
  • docker windows exposed ports cannot be accessed from outside the host

    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 ?



  • Handling multiple persistant volumes for a Rethinkdb Docker Swarm
  • Colorized output from docker to websocket
  • Is Docker Compose suitable for production?
  • Docker-compose v2 expose port to machine
  • How to create docker image for local application taking file and value parameters
  • Requiring apt::source as a dependency gives a syntax error
  • One Solution collect form web for “Import osm data in Docker postgresql”

    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
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.