1

I am trying to import .las files to the postgres database. My pipeline is:

{
  "pipeline":[
{
  "type":"readers.las",
  "filename":"data/pt000002.las",
  "spatialreference":"EPSG:4326"
},
{
  "type":"filters.chipper",
  "capacity":500
},
{
  "type":"writers.pgpointcloud",
  "connection":"host='localhost' dbname='db_example' user='postgres' password='super'",
  "table":"las2",
  "compression":"dimensional",
  "srid":"4326"
}
  ]
}

This pipeline is worked for me before when I have PDAL installed in Conda environment. Now, I have PDAL installed in Docker environment, and when I call pipeline with:

sudo docker run -v /home/user/Documents/projectX:/data pdal/pdal:1.7 pdal pipeline /data/laz2pg.txt 

I get the error:

 pdal/pdal:1.7 pdal pipeline /data/laz2pg.txt 
 PDAL: could not connect to server: Connection refused
 Is the server running on host "localhost" (127.0.0.1) and accepting
 TCP/IP connections on port 5432?
 could not connect to server: Address not available
 Is the server running on host "localhost" (::1) and accepting
 TCP/IP connections on port 5432?

All answers are true. Anyway, I used the same database when I used PDAL with conda. I am using Ubuntu 18.04 Bionic.

  • Quick-and-dirty fix should be to add --net=host to your docker run command, if you have no problem with your container using your host's network interface. – dbaston Aug 6 '18 at 15:43
  • Write that as an answer and I will accept it. :) – Neven Aug 7 '18 at 12:46
2

The problem is that localhost inside of your Docker container refers to the container, not the host where Postgres is running. If you add --net=host to your docker run commend, then your Docker container will use the host's networking stack, and localhost will work as you expect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.