0

I have access to two postgres database servers on different hosts. On server A I access the client using:

psql -h localhost -U user -W db_name

db_name=>

And on the second host B I access the client using (docker image):

docker run -it --rm  --network fiware_default jbergknoff/postgresql-client\
   postgresql://postgres:password@postgres-db:5432/postgres

postgres=#

Now I need to dump database file copied from A (now on B) using:

psql -U postgres -d targetdb -f sourcedb.sql

However, the command psql isn´t recognised second host B. I mean I cannot run commands using psql B

what is then the difference between psqland postgres-clienthere please?

arilwan
  • 3,374
  • 5
  • 26
  • 62

1 Answers1

1

The docker image postgresql-client has psql defined as an entrypoint. See https://github.com/jbergknoff/Dockerfile/blob/master/postgresql-client/Dockerfile#L3 .

So you basically ran psql psql and psql does not understand that. Just leave psql out and start straight with the args.

You can read up on CMD vs ENTRYPOINT here What is the difference between CMD and ENTRYPOINT in a Dockerfile? or here http://goinbigdata.com/docker-run-vs-cmd-vs-entrypoint/ .

SuperSandro2000
  • 581
  • 10
  • 20