2

I'm trying to run this command in my Powershell:

docker run -u postgres --net host -v /`pwd`/file.sql://tmp/setup.sql --rm postgres:9.4 psql -h localhost -U postgres -f //tmp/setup.sql my_db;

which is giving me this error:

psql:/tmp/setup.sql:0: could not read from input file: Is a directory

I tried running a bash in that docker container via this command:

docker run -it -u postgres --net host -v /`pwd`/file.sql://tmp/setup.sql --rm postgres:9.4 bash

and then did a simple ls -l /tmp inside the docker tty, and it's showing that setup.sql file is actually a directory!

drwxr-xr-x 2 root root 40 Jan 13 08:39 setup.sql

How do I go about doing this? I've also tried the bash shell supplied by msysgit with the same results.

kumarharsh
  • 18,961
  • 8
  • 72
  • 100
  • How does Powershell interpret `pwd`? How does Powershell interpret the forward slash for directory paths? Those are Unix conventions. – taco Jan 13 '16 at 09:27
  • This is an issue even with msysgit's bash, and both are giving similar result. For me, powershell treats `\/` and **\\** similarly (as in, I can mix-and-match both like this: `ls C:\Users\khs/.atom` and it works) – kumarharsh Jan 13 '16 at 09:33
  • 1
    Are you using the bash from an old msysgit or from the new git-for-windows? (http://stackoverflow.com/a/26826359/6309) – VonC Jan 13 '16 at 09:34
  • I think it's the old one. Updating now... – kumarharsh Jan 13 '16 at 09:41
  • @Vonc Well, I did that... and now, it's sort of worse than ever. It keeps throwing `fatal error in forked process - fork: can't reserve memory for parent stack 0x600000 - 0x800000, (child has 0x400000 - 0x600000), Win32 error 487` errors – kumarharsh Jan 13 '16 at 11:07
  • I installed Git-2.7.0 64-bit – kumarharsh Jan 13 '16 at 11:07
  • I think that error is coming from the version of GnuMake I'm using (running the commands via a Makefile). If I run the command directly, I'm getting the same error as earlier. – kumarharsh Jan 13 '16 at 11:17
  • Actually, this is expected: docker runs on Linux only. Ssh first to this docker machine (managed by VirtualBox), and you will be in the proper she'll and environment to run docker commands. No Powershell possible with docker. – VonC Jan 13 '16 at 11:18
  • I'm actually able to run *most* of the docker commands, except that mounting is not working as expected. From the github issues I've gone through, they say that powershell *should* work just *fine* – kumarharsh Jan 13 '16 at 11:19
  • So, I've thrown out my copy of make, and updated it to a 64-bit version from here: http://www.equation.com/servlet/equation.cmd?fa=make . Let's see what happens... – kumarharsh Jan 13 '16 at 14:22
  • Atleast the errors like before are not being thrown. I think the gnuMake being distributed here: gnuwin32.sourceforge.net/packages/make.htm won't work with the updated git/msys2 versions, which are built on cygwin and are 64-bit. – kumarharsh Jan 13 '16 at 14:23
  • Okay, I've got a minor breakthrough: files in my `C:` directory are being mounted perfectly, but not from my `D:` drive. I think it's an issue with the fact that only the `C:` drive is made available as `/c` by the docker-machine – kumarharsh Jan 13 '16 at 14:28

0 Answers0