Containerized database file path and root directory unknown

  docker, docker-compose, postgis, postgresql

I recently tried copping my database contents to a csv file with the following command inside my containerized Postgres database:

psql -h ${HOST} -p ${PORT} -U ${USER} --password --c "COPY ${TABLE} TO '${FILE}' WITH (format csv,header);"

I got a response indicating the file was successfully copied however I can’t find where it was copied to. When I try specifying a different path to output the file, I get the response "directory/file.csv: No such file or directory ".

does anyone know where these containerized databases output files and how I can direct them to accessible locations?

I am on a Mac OS and this is some of the relevant info from my docker-compose file with which the database was initiated.

  db:
      image: kartoza/postgis:12.0
      volumes:
        - postgis:/var/lib/postgresql

Source: Docker Questions

LEAVE A COMMENT