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

  • How to run Docker container and watch the logs in one single command
  • how to stop dockerized nginx in foreground from flooding logs?
  • After docker build . the container is not displayed, why?
  • SSH in Docker container causes HTTP 404
  • Stop Solr gracefully when it running in docker
  • How to execute Docker query command on all containers?
  • 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

  • Outbound telnet connection from Docker container refused but works fine on host
  • jar file with arguments in docker
  • Monitor docker containers based on labels assigned
  • How to link jenkins pipeline job to label on docker slaves containers
  • How to shrink size of Docker image with NodeJs
  • docker-compose for a pure data container and web server, postgresql
  • 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.