Docker for Windows not working

后端 未结 19 864
自闭症患者
自闭症患者 2020-12-07 10:56

I\'ve installed Docker toolbox now and I get the error for everything:

Get http://127.0.0.1:2375/v1.20/version: dial tcp 127.0.0.1:2375: ConnectExtcp: No con         


        
相关标签:
19条回答
  • 2020-12-07 11:33

    With Docker 1.8.1d had the same problem, having uninstalled 1.8.1c. Eventually fixed problem by installing latest Virtual Box (5.0.18), rebooting when prompted and starting Kitematic. Kitematic fails at first and offers option to remove and re-install the VM which I did. After that my QuickStart Terminal was OK.

    0 讨论(0)
  • 2020-12-07 11:35
    Close the virtual machine from Virtual Box (you don't have to delete it)
    Close Kitematic
    Close Docker Quickstart Terminal
    

    Now do this in-order:

    Open Kitematic
    Open Docker Quickstart Terminal
    

    Its important not to open Docker Quickstart Terminal before Kitematic, as Kitematic will initialize things for Docker Quickstart Terminal

    I didn't need to execute any command line..

    I hope this will help some body..

    0 讨论(0)
  • 2020-12-07 11:37

    The following worked for me (Docker Toolbox 1.8.1b and Windows 7). It is a simplified version of what @baptiste-gaillard outlined in the comments above. Short answer: Use VirtualBox 5.03 or later from the get-go.

    1. Download VirtualBox 5.03 (nightly build at the time of this post) and extension pack.
    2. Reboot laptop. (Clears out running VirtualBox stuff.)
    3. Install VirtualBox 5.03 and extension pack 5.03.
    4. Delete the default VM entirely (remove files).
    5. Re-run Docker Quickstart Terminal shortcut to generate the default VM.

    The Quickstart script seems to get along better with VirtualBox 5.03 with regards to creating the requisite TLS keys.

    0 讨论(0)
  • 2020-12-07 11:38

    Just run:

    "C:\Program Files\Docker Toolbox\docker-machine" ls
    

    get the machine name, and then run:

    "C:\Program Files\Docker Toolbox\docker-machine" env <MACHINE_NAME_HERE> --shell=[cmd|powershell]
    

    and you should get something like this:

    "C:\Program Files\Docker Toolbox\docker-machine" env default --shell=cmd
    set DOCKER_TLS_VERIFY=1
    set DOCKER_HOST=tcp://192.X.X.X:2376
    set DOCKER_CERT_PATH=C:\Users\X\.docker\machine\machines\default
    set DOCKER_MACHINE_NAME=default
    # Run this command to configure your shell:
    # copy and paste the above values into your command prompt
    

    I also get an error open C:\Users\X\.docker\machine\machines\default\server.pem: The system cannot find the file specified. and solved it by upgrading my VirtualBox to version 5.0.3 (from their nightly builds)

    Long version:

    I got the same problem and after and the "Using Docker from Windows Command Line Prompt (cmd.exe)" section from the installation manual put me in the right direction

    Basically, the way docker works is that the "docker " commands are passed to a docker service (running on port 2375). As you are running the docker from windows host, the service actually runs on the linux host created by docker (you can see it by opening the virtualbox ui).

    The usual flow is the following:

    1. default machine is created
    2. the starter (kinamatic / "Docker Quickstart Terminal" / cmd) of the machine waits for the machine to boot, gets it's IP address and sets the linux ip:port as the service address (instead of 127.0.0.1:2375) in few enviremnt/powershell variables
    3. from this point all docker ... commands are send to the linux host and everything works almost as native linux

    The problem is that there is some issue with the machine setup (my guess the new virtual box but I am not sure and have the time to dig into it). You can see that by runnung the ls command and notice that (at least in my case) the state of the machine is "timeout" and there is no url, unlike the output shown in the manual.

    This causes the enviorment values not to be set and the docker ... commands to fail.

    Apart from running the command, you can also start the Docker Quickstart Terminal that does the same thing but with sh shell

    Regarding the certificate error, I tried to regenrate the certificates from within the virtual machine using:

    /usr/local/bin/generate_cert --overwrite --host=default,127.0.0.1,10.0.2.15,192.168.99.100 --ca=/var/lib/boot2docker/tls/ca.pem --ca-key=/var/lib/boot2docker/tls/cakey.pem --cert=/var/lib/boot2docker/tls/server.pem --key=/var/lib/boot2docker/tls/serverkey.pem
    

    I got "protocol error"s when tried to copy the certificate to the host machine, which reminded me an old virtualbox shared folders bug, so this may not be a problem with docker but with virtualbox - I upgraded to the latest nightly version (5.0.3-102224), regenerated the default image and that seems to solve it. As windows 10 is not officially supported yet neither by docker nor by virtualbox, I am not sure if this is the same thing that causes you to get the certificate error, In any case can try to copy the certificates from the virtual machine (you have the paths in code block) to your local user directory (it is mapped to /c/Users/X/ in the virtual machine)

    0 讨论(0)
  • 2020-12-07 11:38

    This has happened a few times for me on Windows 10 with VirtualBox 5.0.14.

    It seems to be related with not shutting down VirtualBox correctly (I believe) - for example, a power cut!

    1. Shutdown the Docker VM

    2. Close Kitematic

    3. Start the Docker Quickstart Terminal

    4. Type in the terminal:

    docker-machine.exe -D ls

    1. Start Kitematic. VM's show up now.

    If that does not work, try 1-3 again and this time try to regenerate certs. Then do step 4.

    One thing that is odd, is that in the terminal docker images does not list them but says it cannot connect to 127.0.0.1:2375 (but docker-machine ls shows the default machine running on 192.168.99.100:2376).

    0 讨论(0)
  • 2020-12-07 11:39

    I encountered exactly the same error when I run docker images after a system reboot. I used docker version 1.10 on Windows 7 64 bits with virtualbox 5.0.10 and mintty(the terminal come with Git for Windows)

    Executing docker-machine ls showed me the virtual machine is in Timeout state. $ docker-machine ls NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS default virtualbox Timeout So I restarted the virtual machine $ docker-machine restart default Then list the status again told me the cert is bound to an incorrect address: $ docker-machine ls Unable to query docker version: Get https://192.168.56.101:2376/v1.15/version: x509: certificate is valid for 192.168.99.101, not 192.168.56.101 Then I regenerate the cert $ docker-machine regenerate-certs default and finally $ eval $(docker-machine env default --shell=bash) Then docker is working again!

    0 讨论(0)
提交回复
热议问题