Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first step in course now working on Windows 7: docker-compose returned -1 #19

Open
cmosguy opened this issue Dec 17, 2016 · 17 comments
Open

Comments

@cmosguy
Copy link

cmosguy commented Dec 17, 2016

Hey @fideloper ,

I am trying to go through your course. I have Windows 7 and have all the latest downloads for the docker toolbox.

After I pull your repo, I am struggling with the first step. It does not work when I do a docker-composer:

$ cd php-app/

$ docker-compose up -d
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "compose\cli\main.py", line 65, in main
  File "compose\cli\main.py", line 117, in perform_command
  File "compose\cli\main.py", line 849, in up
  File "compose\project.py", line 372, in up
  File "compose\project.py", line 539, in warn_for_swarm_mode
  File "site-packages\docker\api\daemon.py", line 33, in info
  File "site-packages\docker\utils\decorators.py", line 47, in inner
  File "site-packages\docker\client.py", line 139, in _get
  File "site-packages\requests\sessions.py", line 488, in get
  File "site-packages\requests\sessions.py", line 475, in request
  File "site-packages\requests\sessions.py", line 596, in send
  File "site-packages\requests\adapters.py", line 423, in send
  File "site-packages\requests\packages\urllib3\connectionpool.py", line 595, in urlopen
  File "site-packages\requests\packages\urllib3\connectionpool.py", line 363, in _make_request
  File "httplib.py", line 1057, in request
  File "httplib.py", line 1097, in _send_request
  File "httplib.py", line 1053, in endheaders
  File "httplib.py", line 897, in _send_output
  File "httplib.py", line 859, in send
  File "site-packages\docker\transport\npipeconn.py", line 31, in connect
  File "site-packages\docker\transport\npipesocket.py", line 22, in wrapped
  File "site-packages\docker\transport\npipesocket.py", line 49, in connect
pywintypes.error: (2, 'WaitNamedPipe', 'The system cannot find the file specified.')
docker-compose returned -1

I don't understand what is wrong here, and the only thing I can find when searching around is with regards to Windows 7 has issueswith really long path lengths. However, I do not understand this as the directory I am working in is /c/w/php-app so I can not see how this would effect things.

Anyways, would really like your ideas here.

@fideloper
Copy link
Contributor

fideloper commented Dec 17, 2016 via email

@cmosguy
Copy link
Author

cmosguy commented Dec 18, 2016

Hey @fideloper ,

Well, it looks like I had this setup in my path:

C:\Users\MYUSERNAME\AppData\Local\Programs\Python\Python35-32\Scripts
C:\Users\MYUSERNAME\AppData\Local\Programs\Python\Python35-32\

I don't know how that was set or what installed that, perhaps docker toolbox? Not sure, but once I changed the path to be pointed to python2.7 in my windows environment, then everything started working correctly and it pulled all the images that I needed for this.

Thanks for your prompt response.

Adam

@talaviss
Copy link

this does not solve the problem on windows 7

@pablo09
Copy link

pablo09 commented Mar 2, 2017

Make sure that you've built entire project and then instead of Windows Commandline use Docker CLI (do not confuse with normal Windows Powershell!)

@sobelfallcayor
Copy link

Run docker-compose with Docker Quickstart Terminal. It will solve your error

@vipul-rav
Copy link

check your local machine/server docker is running

@ranneyd
Copy link

ranneyd commented Mar 21, 2017

I'm using docker-toolbox in Windows and ran into this problem. I solved it by making sure the environment variables were properly set.

My docker-machine is called toolbox. I made sure it was running and I ran docker-machine env toolbox . It gave me a thing, the last line of which was a comment that contained @FOR /f "tokens=*" %i IN ('docker-machine env toolbox') DO @%i. I ran that and it set all the variables I needed. Then it just worked. Hope that helps

@sobelfallcayor
Copy link

Yes @ranneyd it fixe it. Thanks

@TheGeniesis
Copy link

My solution based on @ranneyd answer (I didn't know how my docker-machine is called):
In Docker Quickstart Terminal I ran docker-machine env, it gave me:

export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="C:\Users\TheGeniesis\.docker\machine\machines\default"
export DOCKER_MACHINE_NAME="default"
export COMPOSE_CONVERT_WINDOWS_PATHS="true"
# Run this command to configure your shell:
# eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env)

I ran eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env)
That's it!

@gitowiec
Copy link

gitowiec commented May 8, 2017

I tried to run @TheGeniesis solution in Git shell for Windows for project https://github.com/andreaskoch/dockerized-magento but all I got was errors:

Gitowiec@INSPIRON42 /c/workspace/magento/dockerized-magento (master)
$ which docker-machine
/c/Docker Toolbox/docker-machine

Gitowiec@INSPIRON42 /c/workspace/magento/dockerized-magento (master)
$ eval $("/c/Docker Toolbox/docker-machine.exe" env)
sh.exe": syntax error near unexpected token `('

Gitowiec@INSPIRON42 /c/workspace/magento/dockerized-magento (master)
$ eval $("c:\Docker Toolbox\docker-machine.exe" env)
sh.exe": syntax error near unexpected token `('

Gitowiec@INSPIRON42 /c/workspace/magento/dockerized-magento (master)
$ bash
bash-3.1$ eval $("/c/Docker Toolbox/docker-machine.exe" env)
bash: syntax error near unexpected token `('

How to run this command under Git shell?

@gitowiec
Copy link

gitowiec commented May 8, 2017

Ok, I managed to get over this problem.
I used shell available under the "Docker Quickstart Terminal" shortcut icon.
Then I changed path in C:\Docker Toolbox\start.sh (line 8 ) from export PATH="/c/Program Files/Docker Toolbox:$PATH" to export PATH="/c/Docker Toolbox:$PATH" (obvious, my installation place was root of C: drive).
Then in magento script I applied this:
https://github.com/andreaskoch/dockerized-magento/pull/40/files
and changed all "DOCKER=which docker" to "DOCKER=which docker.exe"

@sobelfallcayor
Copy link

Open Terminal Gil shell :
Un docker-machine env
than copy line eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env)
than run it :

eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env)

@gitowiec
Copy link

gitowiec commented May 8, 2017

@fallphenix don't You see that I tried this? Take a closer look at my first post in this thread.
I tried it 3 times with slightly differences, all I got was error syntax error near unexpected token '('

@stevemoreau
Copy link

stevemoreau commented Jul 8, 2017

In case it can help somebody, I think I may have met the same trap :)
From a standard mintty terminal (cygwin), I got CMD commands instead of UNIX ones:

[smoreau@xny-wst-001: /cygdrive/d/project/etc/docker] (master % u=)$ docker-machine env
You can further specify your shell with either 'cmd' or 'powershell' with the --shell flag.

SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://192.168.99.100:2376
SET DOCKER_CERT_PATH=C:\Users\smoreau\.docker\machine\machines\default
SET DOCKER_MACHINE_NAME=default
SET COMPOSE_CONVERT_WINDOWS_PATHS=true
REM Run this command to configure your shell:
REM     @FOR /f "tokens=*" %i IN ('"C:\Program Files\Docker Toolbox\docker-machine.exe" env') DO @%i

In this case, you may consider trying this one:
$(docker-machine env | sed -n 's/SET /export /gp')

@Serhiy-Shekhovtsov
Copy link

Serhiy-Shekhovtsov commented Sep 6, 2017

Few helping notes:
if you run it from windows command prompt or batch script, your command is:
@FOR /f "tokens=*" %i IN ('docker-machine env MACHINE_NAME') DO @%i
where MACHINE_NAME is your machine's name

if you run it from bash script, your command is:
eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env MACHINE_NAME --shell=bash)

important note
I hoped that running this command completely solves the issue, but it's not like this. It will set variables for current session. If you close the terminal you have to run the same command again. So, best solution here is to put this as a first line of your .bat or .sh file and always start your terminal by running that file.

@truthadjustr
Copy link

The way I solved it is I went inside the docker host, installed docker-compose there, copy docker docker-compose.yml file there, and run the compose there.

  • First, I copied my id_rsa.pub into the .ssh/{authorized_keys,authorized_keys2} of the virtualbox docker host.
  • scp docker-compose.yml docker@192.168.99.100:/tmp
  • docker-machine ssh mydockerhost
  • sudo curl -L https://github.com/docker/compose/releases/download/1.17.0/docker-compose-`uname -s-uname -m` -o /usr/local/bin/docker-compose
  • sudo chmod +x /usr/local/bin/docker-compose
  • cd /tmp/ && docker-compose up

The windows DOS, cygwin, powershell, whatever is causing all these confusions.

@Herbis
Copy link

Herbis commented Jan 17, 2018

For anyone using Git Bash, for a more permanent solution, you can modify the file:
C:\Program Files\Git\etc\profile
and at the very bottom add line:
eval $(docker-machine env)
So when you start a new session, docker commands should work from the get-go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests