Moby: Trying to connect to Docker API for shell commands throws error

Created on 26 Apr 2016  Β·  40Comments  Β·  Source: moby/moby

The issue: When running any Docker command, the error below is printed, and most commands don't even run

Output of docker version:

Client:
 Version:      1.11.0
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   4dc5990
 Built:        Wed Apr 13 18:13:28 2016
 OS/Arch:      windows/amd64
An error occurred trying to connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.23/version: open //./pipe/docker_engine: The system cannot find the file specified.

Output of docker info:

An error occurred trying to connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.23/info: open //./pipe/docker_engine: The system cannot find the file specified.

Additional environment details (AWS, VirtualBox, physical, etc.):
I'm in Windows 10 with Toolbox 1.11.0 with Kitematic installed

Steps to reproduce the issue:

  1. Install Docker Toolbox
  2. Run any docker command?

Describe the results you received:
The exact error listed in docker info here, and most commands such as docker ps don't work

Additional information you deem important (e.g. issue happens only occasionally):
This message gets pasted to the end of any Docker command I run, and only certain commands even remotely work

Most helpful comment

This is likely due to either the Virtual Machine not being started (try docker-machine start default), or the environment variables not being set in your shell (docker-machine env default should print the instructions for doing so). However, this should be reported in the docker-toolbox issue tracker, or check if there's an existing issue; https://github.com/docker/toolbox/issues?q=is%3Aissue+%22trying+to+connect%22+sort%3Acomments-desc+is%3Aopen

You may be interested in the Docker for Windows beta, which resolves most of these issues; https://blog.docker.com/2016/03/docker-for-mac-windows-beta/. You can register for that beta through https://beta.docker.com.

All 40 comments

This is likely due to either the Virtual Machine not being started (try docker-machine start default), or the environment variables not being set in your shell (docker-machine env default should print the instructions for doing so). However, this should be reported in the docker-toolbox issue tracker, or check if there's an existing issue; https://github.com/docker/toolbox/issues?q=is%3Aissue+%22trying+to+connect%22+sort%3Acomments-desc+is%3Aopen

You may be interested in the Docker for Windows beta, which resolves most of these issues; https://blog.docker.com/2016/03/docker-for-mac-windows-beta/. You can register for that beta through https://beta.docker.com.

I'll close this issue here, because unfortunately we can't help you in this repository/issue tracker, but feel free to comment after Ive closed

The machine is running, I've even got containers running in Kitematic, its just that the shell commands won't work. I'm fairly sure this is a Docker issue not something with Toolbox

If it's running, then I suspect the environment variables aren't set; did you try docker-machine env default, and followed the instructions?

Yes and I now get the following error Invalid bind address format: TCP://192.168.99.100:2376

@nathanleclaire any suggestions?

This is with the Quickstart terminal?

No, just using Windows cmd and docker is in my PATH

You set the environment variables following the instructions of docker-machine env --shell cmd?

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

(The default shell for env is bash).

It just gives me the same address and everything as running without --shell cmd http://puu.sh/oz5yh/5967a5df56.png

OK, I had forgotten we were still checking for cmd on Windows like that.

So to confirm, you follow the instructions listed there, and get this result?

Yes

Solved now, I have no idea how, it was something to do with the values docker-machine env default was giving me

Same issue but gone when changed from powershell to cmd but now it's stuck at docker run command:

c:\_projects\docker>docker run --rm -i -t -p 80:80 nginx
docker: An error occurred trying to connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.23/containers/create: open //./pipe/docker_engine: The system cannot find the file specified..
See 'docker run --help'.

c:\_projects\docker>docker-machine start default
Starting "default"...
Machine "default" is already running.

c:\_projects\docker>docker-machine env --shell cmd default
SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://192.168.99.102:2376
SET DOCKER_CERT_PATH=C:\Users\DBashyal\.docker\machine\machines\default
SET DOCKER_MACHINE_NAME=default
REM Run this command to configure your shell:
REM     @FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd default') DO @%i

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

c:\_projects\docker>docker run --rm -i -t -p 80:80 nginx

Ignore previous last command stuck. First time docker user, so was not sure what was going on. Following some docs and found out that's expected :-)

πŸ‘ Glad to hear it's working now all

I had the same issue after I rebooted Windows once (before reboot docker worked fine).
The advice to follow docker-machine env default instructions worked for me.

This is how it was:

Maksym@MaksymPC MINGW64 ~
$ docker ps
An error occurred trying to connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.23/containers/json: open //./pipe/docker_engine: The system cannot find the file specified.

Maksym@MaksymPC MINGW64 ~
$ docker-machine env default
Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.100:2376": tls: DialWithDialer timed out
You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
Be advised that this will trigger a Docker daemon restart which will stop running containers.

Maksym@MaksymPC MINGW64 ~
$ docker-machine regenerate-certs
Regenerate TLS machine certs?  Warning: this is irreversible. (y/n): y
Regenerating TLS certificates
Waiting for SSH to be available...
Detecting the provisioner...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...

Maksym@MaksymPC MINGW64 ~
$ docker ps
An error occurred trying to connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.23/containers/json: open //./pipe/docker_engine: The system cannot find the file specified.

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

Maksym@MaksymPC MINGW64 ~
$ eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env default)

Maksym@MaksymPC MINGW64 ~
$ docker ps
CONTAINER ID        IMAGE                   COMMAND                  CREATED             STATUS                         PORTS                  NAMES

This is what I did... and worked fine

$ docker-machine env default
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="C:\Users\praveen.k.patidar\.docker\machine\machines\default"
export DOCKER_MACHINE_NAME="default"
# Run this command to configure your shell:
# eval $("C:\installs\Docker\docker-machine.exe" env default)

praveen.k.patidar@CPX-HQKUP9187JJ MINGW64 ~
$ eval $("C:\installs\Docker\docker-machine.exe" env default)

You have to run this: @FOR /f "tokens=*" %i IN ('docker-machine env docker1') DO @%i

I have the same issue and i have to type eval $ blablabla each time i want to build an image.

Can i have real solution please ?

I just ran into this issue. A google search led me to this page, and I ran the commands in docker-machine env default and things worked out well. This was the first time using the product following the quicksart directions here. It creates friction when starting with the product, and it would be nice if there were a more user friendly error message explaining what to do.

I got the same issue then I realized about the invoke-expression missing at the end of the command:

docker-machine env --shell powershell default | Invoke-Expression

Without the invoke, the variables only gonna be printed in your shell.

Hope this can help anyone else.

To avoid runin that command each time try on your windows git bash CLI:
echo 'eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env default)' >> .bash_profile
This will append that string at the end of .bash_profile. Open a new instance to changes take effect.

For anyone else encountering same..

I was getting the Invalid bind address format error when I used the quoted string given back by docker-machine under Windows. Once the quotes were removed, it worked fine.

I was getting the Invalid bind address format error when I used the quoted string given back by docker-machine under Windows. Once the quotes were removed, it worked fine.

which shell was this with?

It was cmd, but it was probably an earlier version of docker tools too. The latest doesn't output the quotes anymore. Just wanted to mention the source of that error, in case anyone sees it again.

C:\acme\Aphrodite\gits\cfg-compose>docker-machine env
SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://192.168.99.100:2376
SET DOCKER_CERT_PATH=C:\Users\Install\.docker\machine\machines\default
SET DOCKER_MACHINE_NAME=default
REM Run this command to configure your shell:
REM     @FOR /f "tokens=*" %i IN ('docker-machine env') DO @%i

I recently encountered the same issue on Windows 10 Anniversary with latest beta (29) installed.
Everything "suddenly" stopped working - I can't pinpoint the cause.
Only way I managed to fix was to uninstall Docker, reinstall Hyper-V and then install Docker again.

Getting this issue on executing docker run command on DOCKER CLI,

panic: spanic: standard_init_linux.go:175: exec user process caused "no such file or directory"red]
        /usr/local/go/src/runtime/panic.go:481 +0x3e6
github.com/urfave/cli.HandleAction.func1(0xc8200ef2e8)
panic(0x/tmp/tmp.n151sEscRu/src/github.com/opencontainers/runc/Godeps/_workspace/src/github.com/urfave/cli/app.go:478 +0x38e
panic(0x/usr/local/go/src/runtime/panic.go:443 +0x4e9
github.c/tmp/tmp.n151sEscRu/src/github.com/opencontainers/runc/Godeps/_workspace/src/github.com/opencontainers/runc/libcontainer/factory_linux./tmp/tmp.n151sEscRu/src/github.com/opencontainers/runc/Godeps/_workspace/src/github.com/opencontainers/runc/libcontainer/factory_linux.go:277 +0x5b1ners/runc/libcontainer.(*LinuxFactory).StartInitialization(0xc820051630, 0x7ff2188a7728, 0xc82012a2a0)
main.glo/tmp/tmp.n151sEscRu/src/github.com/opencontainers/runc/main_unix.go:26 +0x68
reflect./usr/local/go/src/reflect/value.go:435 +0x120d 0x4, 0xc8200ef268, 0x1, 0x1, 0x0, 0x0, ...)
reflect./usr/local/go/src/reflect/value.go:303 +0xb1ef268, 0x1, 0x1, 0x0, 0x0, 0x0)
github.c/tmp/tmp.n151sEscRu/src/github.com/opencontainers/runc/Godeps/_workspace/src/github.com/urfave/cli/app.go:487 +0x2ee
github.c/tmp/tmp.n151sEscRu/src/github.com/opencontainers/runc/Godeps/_workspace/src/github.com/urfave/cli/command.go:191 +0xfec
github.c/tmp/tmp.n151sEscRu/src/github.com/opencontainers/runc/Godeps/_workspace/src/github.com/urfave/cli/app.go:240 +0xaa4
main.mai/tmp/tmp.n151sEscRu/src/github.com/opencontainers/runc/main.go:137 +0xe24

I got the same error when I tried to launch docker ps, but the rest of the commands work properly. After some time we found that there was any active docker-machine.

If you launch docker-machine ls command and you see that they are running (I have 2) but any of them is the active, then, you must launch the next one to activate the default machine.

eval $(docker-machine env default)

This fixes the issue.

@abhishekraghav your error is not related to this one, can you please open a new issue; it looks like an error in the RunC runtime, and we should look into that. Can you open an issue, and include the output of docker version, docker info and the error message you posted (also if possible describe when / how you got that error)?

i have same problem β€œopen //./pipe/docker_engine: The system cannot find the file specified.”
because i have a vpn running after i turned off vpn. it works

Deinstall and re-installation of Docker for Windows solved the issue in my case (Win 10).
I rember, the first install did not finish correctly, because, when doing the second install, I received a Welcome Popup Screen (which was new to me) saying "Docker is now up adn running! Open your favorite terminal and start typing Docker commands! ..." This popup was missing at the first attempt.

I had the same issue, try to switch between Linux or windows containers from menu. This help me.

I have same issue on windows 8, after fresh instalation using DockerToolbox.exe

open //./pipe/docker_engine: The system cannot find the file specified
on configuration on Windows, the docker client must be run elevated to connect.
This error may also indicate that the docker daemon is not running.

I tried everything and it doesnt work

I was facing the same issue when running in the command prompt in windows. I run the command in 'Docker Quickstart Terminal' and it is fine now.

I had the same problem on Windows 10, Docker Community Edition, default Windows installer. Version 17.06.2-ce-win27 (13194) Channel: stable 428bd6c

1. I tried running the Getting Started instructions here: https://docs.docker.com/get-started/#setup

_

Setup
Before we get started, make sure your system has the latest version of Docker installed.

Install Docker

Note: version 1.13 or higher is required
You should be able to run docker run hello-world and see a response like this:

$ docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
...(snipped)...

_

For more Docker experienced users or folks in support: I could create machines, docker-machine ssh into those machines, and run standard "docker" commands - but I could not just run the commands from a default Windows 10 Terminal per the setup instructions above.

Log attached: log.txt

2. In the Docker task tray, at startup is a consistent error in the Settings panel is that the Daemon "Failed to Start"

However in Windows Services control panel - the Docker for Windows Service is running. I tried to restart the service, and there were no errors through the restart to the running status. The task tray Docker icon still was highlighted red.

3. I resolved this issue by navigating forums, testing and looking at the logs, and searching forums based on log outputs, and taking the steps below that perhaps are missing in the "Getting Started, Setup tasks" for this version, or are missing in the installer and assumed to be present by the author of the Setup instructions.

To see the Docker log there is a link in the "Diagnose & Feedback" section. My priority was to get the local Docker examples running without the need to create multiple Docker Machines via the docker-machine create utility.

  1. After I installed the Windows 10 Docker Community Edition, install Cmder. The standard Windows 10 Command Prompt does not support standard terminal output from various Linux VM's. Cmder is available here: http://cmder.net/

  2. Launch Cmder.

  3. In the Cmder terminal Window - type the following command:
    docker-machine ls [press enter]

  4. I had nothing created. Apparently "default" is referenced frequently in the Docker documentation, so I created "default" with the following command:
    docker-machine create default [press enter]
    NOTE: After you create "default" type the following command:
    docker-machine ls [press enter]

    • you see your new "default" Docker machine up and running! πŸ‘
  5. Next type the following command:
    docker-machine env default [press enter]
    NOTE: This does not actually execute anything, it just prints the commands which ultimately set the environment variables that Docker is looking for at runtime in order to function. To run all of these commands, copy each line of the output, and paste it in the terminal, and press enter to ensure that ALL critical environment variables are set.

  6. Type the following command:
    docker run hello-world [press enter]
    Assuming all went well, you should see the hello-world successful output printed in your beautiful Docker Happy Cmder on Windows 10! πŸ‘

Hopefully someone in the Docker support / development / technical writers will update the Getting Started instructions here: https://docs.docker.com/get-started/#setup
Or the other options is modify the Windows 10 Installer to do all of the above out of the box. Either way the current instructions on a clean install don't work as published on Production for those new to Docker. I hope this helps others, and Happy Saturday. I'm still evaluating and doing a deep dive on Docker from development through the production to understand best practices, but obviously that all needs to start with a stable base install. πŸ₯‡βœŒοΈπŸ’‘πŸ˜πŸ––πŸ‹

@asouthwick could you move your comment to an issue in the documentation issue tracker? There's a "request docs changes" link in the documentation to open a new issue:

screen shot 2017-09-25 at 11 13 33

In the Docker task tray, at startup is a consistent error in the Settings panel is that the Daemon "Failed to Start"
In the Cmder terminal Window - type the following command:
docker-machine ls [press enter]

When running Docker for Windows, there is no need to install VirtualBox, or create machines using docker machine; if your docker daemon fails to start, that's either a bug, or something in your system's configuration; that's best reported in the docker for windows issue tracker: https://github.com/docker/for-win/issues.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Nurza picture Nurza  Β·  3Comments

dbanck picture dbanck  Β·  3Comments

bhuvan picture bhuvan  Β·  3Comments

cefn picture cefn  Β·  3Comments

noahwhite picture noahwhite  Β·  3Comments