Docker not working in Windows10 - windows

I am using Docker version 1.12.2, build bb80604 and VirtualBox 5.1.6.
I was able to install Docker Toolbox correctly but I am not able to start the default VM.
I tried to follow the instruction given here but I am still getting The system cannot find the file specified error. I don't have Hyper-V enabled on system.
F:\>docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default not found Error open C:\Users\Animesh\.docker\machine\machines\default\config.json: The system cannot find the file specified.
F:\>docker-machine env --shell=cmd
open C:\Users\Animesh\.docker\machine\machines\default\config.json: The system cannot find the file specified.
F:\>docker rm default
An error occurred trying to connect: open //./pipe/docker_engine: The system cannot find the file specified.
How can I solve this issue?

It looks like something bad happened to your docker-machine default machine.
To recover, do the following:
docker-machine rm -f default
Next, open the virtualbox GUI and make sure that there isn't a VM that corresponds with that old "default" VM, just in case. If there is, manually delete it from there.
Now, open the quickstart terminal again and it should create a new "default" virtual machine for you.
Alternatively, you can create it like this:
docker-machine create -d virtualbox --virtualbox-memory 2048 default
At that point, your sequence of commands should work as expected again.

You may need another couple of steps additional to what #programmerq mentioned.
Create empty text file: C:\Users\<user>\.docker\machine\machines\default\config.json
Stop VBoxHeadless.exe service from Windows task manager
Try docker-machine rm -f default and docker-machine create -d virtualbox --virtualbox-memory 2048 default commands afterwards to remove/add default

step 1: run: docker-machine rm -f default - (on your mac terminal or control panel)
step 2: run: docker-machine create -d virtualbox --virtualbox-memory 2048 default
It worked like miracle.

If you are a Windows Home user, you will not be able install the Docker for Windows Desktop edition, as it requires Hyper-V virtualization. This is supported only by Windows Professional and Enterprise editions.
As the Docker for Windows Desktop edition requires Hyper-V virtualization, you will not be able to install it if you are a Windows Home user. It is only supported by Windows Professional and Enterprise editions.
If you have installed Docker Toolbox and you are dealing with errors while trying to start the default machine you can create a new one by running:
docker-machine create box
the in order to see how to connect your Docker Client to the Docker Engine running on the virtual machine created run:
docker-machine env box
the command that you need to run in order to configure your shell will then appear:
eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env box)
Check that the installation is runnung correctly by running:
docker run hello-world
Then you just need to start your machine every time you need to use docker:
docker-machine start box
and follow the second and third steps above for the configuration.

Related

Connecting Docker Windows WSL Ubuntu to VMware Ubuntu

I am trying to connect my Windows 10 Home system to be able to run full Linux OS Docker containers. I have installed Docker on both WSL Ubuntu 18.04 as well as a VMware Ubuntu 18.04.
I was trying to follow this guide.
However, I get stuck trying to configure the Daemon as per the instructions.
Can’t use Docker for Windows?
This is only necessary if you are NOT running Docker for Windows!
No problem, just configure your Docker daemon to use -H tcp://0.0.0.0:2375 and --tlsverify=false. Then you can follow along with the rest of this guide exactly.
If you go down this route, I highly recommend rolling your own VM with VMware Player instead of using the Docker Toolbox because VirtualBox has crazy edge case shared folder bugs that will ruin your life at some point. Don’t worry, VMware Player is free. Just Google how to set up Ubuntu 16 server on VMware Player.
When I try to change the Docker Daemon by making a daemon.json file I get errors. I've also tried editing the .profile files and the .bashrc as per other guides (another guide), with no luck.
I am unable to check the DOCKER_HOST variable on the VM Ubuntu.
Don't make things complicated. In your case, why WSL if you just want to connect to a remote daemon? Why not simply use the windows docker client?
Setup you favorite local VM with docker.
Example: I have installed a CentOS distro running on local VMWare Workstation. All Hyper-V of course deinstalled/deactivated.
In this VM, enable tcp access for the daemon.
If you have a systemd linux distro (like mine CentOS), execute this:
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo echo '[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H unix:// -H tcp://0.0.0.0:2375' >> /etc/systemd/system/docker.service.d/options.conf
sudo systemctl daemon-reload
sudo systemctl restart docker`
Test if the port is open with docker info. You should get an API access warning at the bottom result.
Download the Windows docker cli zip from here: https://download.docker.com/win/static/stable/x86_64/
Move the docker.exe to any folder, for ex. your Documents folder.
Then put this folder path into your Windows PATH variable.
Set the docker host: Open PowerShell, execute setx DOCKER_HOST <VM-IP>:2375 and close it.
Open a new PowerShell and call docker info.
You should see the docker and daemon infos.
Do what ever you like now... :-)

Setting up docker on the mac: Cannot connect via localhost

I'm just setting up docker on my Mac. The installation worked and I got some containers running (following the getting-stared guide), but now I want to connect with my browser to localhost, to show a web app.
For that I'm following this guide: https://docs.docker.com/engine/userguide/containers/usingdocker/
In the last section it is said, that you simple go with your browser to: localhost:XXXXX wheras XXXXX is the port, that you found out using the command
docker ps -l
First problem: here nothing happends. The browser is showing an empty page (ERR_CONNECTION_REFUSED)
Further more in the guide it is explained, that for Mac you can check your ip address via the command:
docker-machine ip your_vm_name
Here appears the second problem: This command results in an error-message:
Host does not exist: "your_vm_name"
So my questions are:
How to set up the virtual machine (or "your_vm_name" respectively)?
Does it have to do anything with the vhosts file on my Mac OS?
Is there mybe a conflict with MAMP (which I'm also using sometimes)?
Thanks in advance!
And thanks to GianArb for the very fast answer! That solution works as well.
Just to contribute to the community, I just found out by myself, that the solution was too simple to be true.
Instead of your-vm-name use default (obviously the default-host that is set up by docker), so I just used:
docker-machine ip default
and then I got the right IP.
Hello the process to start to use docker on mac with docker-machine is like:
Create a new docker machine on virtualbox, you can use a name like "your_vm_name" or just "default" in this way you can not use the name because "default" is a keyword that docker-machine try to use when you don't specify nothing.
The problem here is, why docker-machine ip your_vm_name doesn't provide the good ip? Can you copy the result of your command
echo $DOCKER_HOST
Usually it's 192.168.99.100
thanks a lot
Actual for Mac OS:
If there is no real need in VirtualBox machine you can just remove it.
Docker can start Linux containers under Mac OS without any VirtualBox machines.
Without any VirtualBox machines, all exported ports are available on the localhost:*.
Remove docker machine
docker-machine ls
docker-machine stop default
docker-machine rm default
Make sure that you don't have the command eval $(docker-machine env ...) in your ~/.bashrc or ~/.zshrc.
Otherwise, nothing will work. You will see the error Error: No machine name(s) specified and no "default" machine exists.
By the default configuration no need to have any env variables like $DOCKER_*
In my case, the only docker installed by downloading a .dmg image from the official site works without any problems. Any versions installed via brew didn't work out of the box.
PS: tested on Mac OS 10.13 and 10.14

Running docker shell on Windows

I've just installed Docker toolbox 1.9.1 (only docker itself plus Kitematic as I already have both VirtualBox and Git for Windows installed). Clicking on Docker Quickstart Terminal icon wasn't working so I had to associate it with C:\Program Files (x86)\Git\bin\bash.exe as suggested. Now it starts fine but I'm unable to run docker command:
Kitematic works just fine but I need the shell. How do I fix it?
Check where docker-machine.exe has been installed (or copy the latest released one in your %PATH%) and use that, instead of the quickstart.
From a regular CMD session:
# find the name of the machine created.
docker-machine ls
docker-machine env --shell cmd <nameOfTheMachine>
docker-machine ssh <nameOfTheMachine>
The shell you are after is the one provided by the Linux TinyCore boot2docker.iso image managed by VirtualBox, not the git-bash installed on your Windows host.
Here is an alternative option. Create the following docker.cmd batch:
cd "%ProgramFiles%\Docker Toolbox"
"%ProgramFiles(x86)%\Git\bin\bash.exe" --login -i "%ProgramFiles%\Docker Toolbox\start.sh"
Now you need to start the default VM in your Oracle VirtualBox Manager (created automatically when you installed Docker for Windows):
and then the batch:

Mac OS X & Docker 1.9.1 Insecure registry location

I am trying to configure my Docker instance to allow insecure registries on my Mac. However, in the new installation for Docker, I can't find which config file to place the
--insecure-registry host:port
I see in some places to put it in the /etc/default/docker file, yet the folder default doesn't exist. I've even tried reating a docker file in the /etc/defaults dir to no avail.
I could really use some insight. Thanks.
Use docker-machine with the --engine-insecure-registry to accomplish this on Mac. If you initially created your machine with name dev you will need to stop and remove it first:
docker-machine stop dev
docker-machine rm dev
Then, assuming your registry was at registry.mydomain.internal:8443 you would create the new machine using:
docker-machine create -d virtualbox --engine-insecure-registry registry.mydomain.internal:8443 dev

Docker Toolbox Mac command line and Kitematics fails

I have installed the new Docker Toolbox application for the Mac using both the graphical installer (the official one) and brew cask install.
In both cases, the Virtual Machine is correctly created, but something seems to be wrong in the environment because when I try to execute docker-machine on the command line, it fails like this:
$ docker-machine env default
open /Users/adeynack/.docker/machine/machines/default/ca.pem: no such file or directory
When I try Kitematics, it fails like this:
I tried Delete VM and retry setup, without success. Any insight or idea is welcome here.
EDIT: I am already using the test build 5.0.3 of VirtualBox.
This may have been caused by an issue with Virtualbox. The issue has been fixed with the latest testbuild for virtualbox here: Virtualbox Test build.
You have to uninstall your current version of Virtual Box and install the test build.
Edit
You may need to create a new docker machine.
Create a new docker machine:
docker-machine create --driver virtualbox dev
Next, start the dev environment:
docker-machine env dev
Set up the environment for the dev machine:
eval "$(docker-machine env dev)"
This worked for me:
docker-machine regenerate-certs default
docker-machine restart default

Resources