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

Question:

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 "composeclimain.py", line 65, in main
  File "composeclimain.py", line 117, in perform_command
  File "composeclimain.py", line 849, in up
  File "composeproject.py", line 372, in up
  File "composeproject.py", line 539, in warn_for_swarm_mode
  File "site-packagesdockerapidaemon.py", line 33, in info
  File "site-packagesdockerutilsdecorators.py", line 47, in inner
  File "site-packagesdockerclient.py", line 139, in _get
  File "site-packagesrequestssessions.py", line 488, in get
  File "site-packagesrequestssessions.py", line 475, in request
  File "site-packagesrequestssessions.py", line 596, in send
  File "site-packagesrequestsadapters.py", line 423, in send
  File "site-packagesrequestspackagesurllib3connectionpool.py", line 595, in urlopen
  File "site-packagesrequestspackagesurllib3connectionpool.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-packagesdockertransportnpipeconn.py", line 31, in connect
  File "site-packagesdockertransportnpipesocket.py", line 22, in wrapped
  File "site-packagesdockertransportnpipesocket.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:Python27Scripts in both my user and system environment variables. I also tried this using Python 3, and it still doesn’t work.

Asked By: Yahya Uddin

||

Answers:

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>.

Answered By: jenming

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
Answered By: Bala

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>)

Answered By: Abdourahmane FALL

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.

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.

Answered By: d23

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.

Answered By: Dustin Rasener

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

Answered By: Razze

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

Answered By: Mike Glenn

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.
Answered By: Ashwin J

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:UsersTheGeniesis.dockermachinemachinesdefault"
export DOCKER_MACHINE_NAME="default"
export COMPOSE_CONVERT_WINDOWS_PATHS="true"

#### Run this command to configure your shell:
eval $("C:Program FilesDocker Toolboxdocker-machine.exe" env)

I ran eval $("C:Program FilesDocker Toolboxdocker-machine.exe" env). That’s it!

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

Answered By: HackAfro

Quitting Docker and stopping Docker VM solved this for me.

Answered By: AUBG

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.

Answered By: George Stocker

Had this issue on Windows after restarting Docker Desktop.

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

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

Answered By: Maoritzio

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.

Answered By: Jiren

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

  • ./:/app:cached
    TO
  • "./:/app:cached"
Answered By: sydadder

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.

Answered By: tmndungu

I bumped into this issue after I executed wsl --shutdown.

However, Docker Desktop still shows that it is running in the tray, but it does not show any containers which I did not delete.

Just had to make sure Docker Desktop is exited completely and relaunch it back again.

Answered By: yuenherny

There is another chance Why this error occurring

Go to docker Dashboard settings > General

and check use Docker compose v2 is checked or not. if it is not Please it. Then try again it will work

enter image description here

Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.