Docker Compose Up gives "The system cannot find the file specified." error

PythonDockerDocker Compose

Python Problem Overview


I have recently installed Docker Toolbox on my Windows 10 machine.

However, whenever I run docker-compose up I get the following error message:

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

Note that I have C:\Python27 and C:\Python27\Scripts in both my user and system environment variables. I also tried this using Python 3, and it still doesn't work.

Python Solutions


Solution 1 - Python

I just forgot to start "Docker for Windows" which resulted in that error.

Solution 2 - Python

You and I may or may not have the same problem. In the link posted by @Haken Lid above, the issue is with the PATH environment variable not having the correct version of Python.

BUT, for me, the issue was that I had not set all of my environment variables, by running

eval $(docker-machine env <vmname>)

before I ran the docker-compose <any command>.

Solution 3 - Python

Make sure Docker for Windows is up and running in the system tray. That was my problem.

Solution 4 - Python

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

The Docker Quickstart Terminal is mostly a regular shell but allows to create a default machine. It can be used to connect to other machines as well:

eval $(docker-machine env <MACHINE_NAME>)

Solution 5 - Python

I had this problem with a fresh install of Docker on Windows 10. My issue was that I hadn't actually run Docker first; I just installed the .msi and ran "docker-compose" from the command line.

Once I ran Docker, (and followed a few more post-installation steps, to include logging out of and restarting my computer) I was able to run docker-compose without issue.

Solution 6 - Python

You can set properties by typing the following commands:

docker-machine env --shell cmd default
@FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd default') DO @%i

Solution 7 - Python

Quitting Docker and stopping Docker VM solved this for me.

Solution 8 - Python

I had the same problem.

Starting the docker daemon resolved the issue. Just search for docker pressing windows key and click on "Docker Dekstop". Daemon should be running in a minute.

Solution 9 - Python

I spent close to an hour fixing this issue on my Windows machine.

  1. Install Python (version 3.6.1 worked fine for me), selecting the option "add to PATH".
  2. Install Docker.
  3. Reboot your machine.
  4. On your notification bar you'll see an icon for Docker. Right-click it and select Settings.... Go to Shared Drives and select C: drive. You will be prompted for credentials. [*]
  5. Run docker build .
  6. Run docker-compose up.

[*]: If you don't do this step you might see this error when on step 6: ERROR: for website Cannot create container for service website: C: drive is not shared. Please share it in Docker for Windows Settings. If after entering your credentials the C: drive isn't checked, create a new user for your machine that has full access to the folder where you will run docker-compose up.

Solution 10 - Python

In Docker Quickstart Terminal I ran docker-machine env, and 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!

This solution was copied from this issue. I'm on a Windows 10 Home. This solved my problem.

Solution 11 - Python

You might be missing the inverted commas somewhere on the docker-compose.yml file Eg. Change volumes:

  • ./:/app:cached TO
  • "./:/app:cached"

Solution 12 - Python

I ran into this issue after the Docker Quickstart Terminal hanged a while on "Waiting for an IP..." during start up.

Restarting the Docker Quickstart Terminal fixed everything.

Solution 13 - Python

I have used Docker Toolbox since I am on Windows 8.1. After many hours of troubleshooting I solved this issue by:

  • Uninstalling Python 2.7 and installing Python 3.6.4 and adding it to the environment variables.
  • Restarting Docker Quickstart Terminal and running the command from there.

Solution 14 - Python

Had this issue on Windows after restarting Docker Desktop.

The solution was to close my terminal window and open a fresh one.

Solution 15 - Python

Same error will be caused if docker for windows was installed and activated, but never logged in..

Solution 16 - Python

I had this issue today, here's what fixed it for me on Windows.

  1. I went to Docker Settings, and clicked "Reset" on the left side.
  2. I then clicked "Reset to Factory defaults..."
  3. Then went to "Shared Drives" and enabled shared drives (doesn't matter which drive) for Docker, and clicked "reset credentials", and insert my credentials.

If everything is working correctly, the box will remain checked after you click "reset credentials". If it's not, resetting your credentials will cause the box to become unchecked and you'll have to Reset Docker to Factory defaults again.

Solution 17 - Python

Had same issue on Windows 10 after installing Docker using Docker Desktop Installer and left out the last installation for "WSL2 Linux kernel update package for x64 machines". After installing that and restart the laptop it was fine.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionYahya UddinView Question on Stackoverflow
Solution 1 - PythonRazzeView Answer on Stackoverflow
Solution 2 - PythonjenmingView Answer on Stackoverflow
Solution 3 - PythonMike GlennView Answer on Stackoverflow
Solution 4 - PythonAbdourahmane FALLView Answer on Stackoverflow
Solution 5 - PythonDustin RasenerView Answer on Stackoverflow
Solution 6 - PythonBalaView Answer on Stackoverflow
Solution 7 - PythonAUBGView Answer on Stackoverflow
Solution 8 - PythonJirenView Answer on Stackoverflow
Solution 9 - PythonMaria Ines ParnisariView Answer on Stackoverflow
Solution 10 - PythonHackAfroView Answer on Stackoverflow
Solution 11 - PythonsydadderView Answer on Stackoverflow
Solution 12 - Pythond23View Answer on Stackoverflow
Solution 13 - PythonAshwin JView Answer on Stackoverflow
Solution 14 - PythonAndrey Mikhaylov - lolmausView Answer on Stackoverflow
Solution 15 - PythonMaoritzioView Answer on Stackoverflow
Solution 16 - PythonGeorge StockerView Answer on Stackoverflow
Solution 17 - PythontmndunguView Answer on Stackoverflow