1

I have postgres running inside a docker container exposed on port 5432.

ContainerID     postgres:latest   "docker-entrypoint.s…"   32 minutes ago   Up 32 minutes   0.0.0.0:5432->5432/tcp, :::5432->5432/tcp   postgres  

I have no dump scripts installed on my local that I would like to install. Normally on local, if I have postgres installed locally I simply run the following command.

perl install.pl FULL SCHEMA_NAME 127.0.0.1 5432 postgres password

But now I have postgres running in a container in docker so if I try running the same command I get an error saying

'psql' is not recognized as an internal or external command, operable program or batch file.  

I do not have postgres installed on local. I am also on windows. How can execute the script?

  • 1
    If you do not have `psql` installed, and the script requires `psql` installed, then you cannot run the script. – Turing85 Nov 20 '21 at 15:29
  • yes but to install psql I need to install postgres on local, I do not want to use local postgres but the docker one. –  Nov 20 '21 at 15:32
  • The container doesn't have perl installed, so even if you copied the script to the container, you couldn't run it. I'm thinking that the easiest way to get your script to run is to make your own postgres image that has perl installed and also has the install.pl script. Then you could run the script in the container. – Hans Kilian Nov 20 '21 at 15:33
  • We need something with the `psql`-command and the capabilities to execute the perl scripts. We can install `psql` on the host (this doesn't mean that we have to start the server) or we create a container that has both `psql` and a `perl` interpreter installed. – Turing85 Nov 20 '21 at 15:36
  • @Turing85 - is there a way to install psql on host without having to install the entire postgres? I can't seem to find a way on windows to just include psql alone –  Nov 20 '21 at 15:39
  • No, there is not (at least no ready-to-use one). See [this question](https://stackoverflow.com/questions/33854798/how-do-i-install-just-the-client-tools-for-postgresql-on-windows). – Turing85 Nov 20 '21 at 15:39
  • ah, seems there is an option in the installer to only download command line tools without having to download server... thanks!! –  Nov 20 '21 at 15:42

0 Answers0