I ran the command, brew services start docker-machine.
It says, "Successfully started docker-machine". But, I got error when I ran docker ps -a. Please help.
brew services start docker-machine
==> Tapping homebrew/services
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 1488, done.
remote: Counting objects: 100% (367/367), done.
remote: Compressing objects: 100% (266/266), done.
remote: Total 1488 (delta 148), reused 267 (delta 93), pack-reused 1121
Receiving objects: 100% (1488/1488), 437.97 KiB | 3.04 MiB/s, done.
Resolving deltas: 100% (624/624), done.
Tapped 1 command (38 files, 540.5KB).
==> Successfully started `docker-machine` (label: homebrew.mxcl.docker-machine)
% docker ps -a
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
docker-machine create --driver virtualbox default gives me the following errors:
docker-machine create --driver virtualbox default
Running pre-create checks...
(default) Image cache directory does not exist, creating it at /Users/perryluo/.docker/machine/cache...
(default) No default Boot2Docker ISO found locally, downloading the latest release...
(default) Latest release for github.com/boot2docker/boot2docker is v19.03.12
(default) Downloading /Users/perryluo/.docker/machine/cache/boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v19.03.12/boot2docker.iso...
(default) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
Creating machine...
(default) Copying /Users/perryluo/.docker/machine/cache/boot2docker.iso to /Users/perryluo/.docker/machine/machines/default/boot2docker.iso...
(default) Creating VirtualBox VM...
(default) Creating SSH key...
(default) Starting the VM...
(default) Check network to re-create if needed...
(default) Found a new host-only adapter: "vboxnet0"
Error creating machine: Error in driver during machine creation: Error setting up host only network on machine start: /usr/local/bin/VBoxManage hostonlyif ipconfig vboxnet0 --ip 192.168.99.1 --netmask 255.255.255.0 failed:
VBoxManage: error: Code E_ACCESSDENIED (0x80070005) - Access denied (extended info not available)
VBoxManage: error: Context: "EnableStaticIPConfig(Bstr(pszIp).raw(), Bstr(pszNetmask).raw())" at line 242 of file VBoxManageHostonly.cpp
$ sudo docker-machine create --driver virtualbox default
Docker machine "default" already exists
$ docker-machine stop default
Stopping "default"...
Machine "default" is already stopped.
$ docker-machine start default
Starting "default"...
(default) Check network to re-create if needed...
(default) Found a new host-only adapter: "vboxnet2"
Error setting up host only network on machine start: /usr/local/bin/VBoxManage hostonlyif ipconfig vboxnet2 --ip 192.168.99.1 --netmask 255.255.255.0 failed:
VBoxManage: error: Code E_ACCESSDENIED (0x80070005) - Access denied (extended info not available)
VBoxManage: error: Context: "EnableStaticIPConfig(Bstr(pszIp).raw(), Bstr(pszNetmask).raw())" at line 242 of file VBoxManageHostonly.cpp
$ docker-machine env default
Error checking TLS connection: Host is not running
Same problem here. I have found that docker-machine is trying to move its HostOnly network to 192.168.99.1/24. This is outside the range VirtualBox allows on MacOS.
See https://www.virtualbox.org/manual/ch06.html#network_hostonly :
On Linux, Mac OS X and Solaris, Oracle VM VirtualBox will only allow IP addresses in the 192.168.56.0/21 range to be assigned to host-only adapters.
That range corresponds to 192.168.56.1 - 192.168.63.255.
The solution that worked for me is:
docker-machine rm default
docker-machine create -d virtualbox --virtualbox-hostonly-cidr "192.168.63.1/24" default
You're starting docker-machine as a service but not any Docker Socket.
Once you have installed docker and docker-machine with brew, you actually need to run Docker on a Linux kernel, docker binary is just the client and you cannot run Docker natively in OS X.
So first, you need to create a machine with VirtualBox where you're actually going to run Docker. For that you should do:
docker-machine create --driver virtualbox default
In case that you receive an error like:
Running pre-create checks...
Error with pre-create check: "VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path"
That means that you don't have Virtual Box installed, so you need to cask-install it on your MacBook:
brew install virtualbox --cask
Once you have already installed VirtualBox, it's time to create a machine with the aforementioned command. You should have an output like the following:
docker-machine create --driver virtualbox default
[...]
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env default
But still if you run docker ps or similar it will complain that the Socket isn't running. The reason is that Docker CLI looks by default for the local daemon, so we have to explicitly tell the CLI that we want to use a different one.
For that, run the following command that will tell your CLI which machine do we actually want to use:
docker-machine env default
Next time you run docker ps or any other Docker command, it will work and run on the created default machine.
PD: Remember to stop the machine when you're not using it! For that you can just use the following command:
docker-machine stop default
Did everything before sounded like a lot of work and you just want to use Docker now without any further work?
Install it as an application and forget about docker-machine:
brew cask install docker
That's it.
Related
I downloaded minikube after that ...
I did minikube start... so, node started
I played around with some containers(deployment object)
Now when I am doing docker ps => it's showing all the k8's container running -_-"
What I wanted to see is the local Docker Daemon containers rather than Vm's containers
When I run minikube docker-env it shows:
Exiting due to ENV_DRIVER_CONFLICT: 'none' driver does not support 'minikube docker-env' command
What should I do now to connect to local Docker Daemon ?
I am using Ubuntu 18 :)
Since you started minikube without specifying driver, the host docker daemon will be used, so you can access it without any special environment variables. That’s why you see “ Exiting due to ENV_DRIVER_CONFLICT: 'none' driver does not support 'minikube docker-env' command”
Try starting minikube using other driver viz minikube start --driver=hyperkit
or stopping minkikube
I have a project in Visual Studio 2019. I want to learn Docker and try to deploy my 2 web applications in a swarm.
When i use command
"docker-machine create -d hyperv --hyperv-virtual-switch "stationext" myvm1"
Docker creates a virtual machine. I can see it in Hyper-V Manager. But this VM is with Linux.
How to create VM by command "docker-machine create" with Windows on board?
Log from creating
PS C:\WINDOWS\system32> docker-machine create -d hyperv --hyperv-virtual-switch "stationext" myvm3
Running pre-create checks...
Creating machine...
(myvm3) Copying C:\Users\Sergii\.docker\machine\cache\boot2docker.iso to C:\Users\Sergii\.docker\machine\machines\myvm3\boot2docker.iso...
(myvm3) Creating SSH key...
(myvm3) Creating VM...
(myvm3) Using switch "stationext"
(myvm3) Creating VHD
(myvm3) Starting VM...
(myvm3) Waiting for host to start...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: C:\Program Files\Docker\Docker\Resources\bin\docker-machine.exe env myvm3
What i see in VM
I think the behavior is the expected one, don't know where did you see that you will be launching windows OS containers, boot2docker is Linux as you can see on their git:
https://github.com/boot2docker/boot2docker#readme
At the same time, you can see that this is deprecated in favor of Docker for Windows.
For running windows host on docker I think you should have a look at this:
https://www.docker.com/products/windows-containers
I am new in using docker and I am trying to implement SWARM according to this tutorial -
https://docs.docker.com/get-started/part4/#create-a-cluster
The tutorial starts with -
Launch Hyper-V Manager
Click Virtual Switch Manager in the right-hand menu
Click Create Virtual Switch of type External
I am using Windows 10 PRO and I cannot use Hyper-V Manager and Docker terminal at the same time. Because if I activate Hyper-V and then start docker terminal, my PC shows an error and shut down automatically.
So, I tried to create a virtual machine without Hyper-V by following code
$ docker-machine create -d hyperv --hyperv-virtual-switch "myswitch" myvm1
and as expected I got this error -
Wrapper Docker Machine process exiting due to closed plugin server (connection is shut down)
Error with pre-create check: "read tcp 127.0.0.1:50588->127.0.0.1:50587: wsarecv: `An existing connection was forcibly closed by the remote host."`
So, is there any alternative solution how can I proceed or to use Hyper-V Manager in Windows 10 without such problem.
Thanks a lot for your time :)
Virtualbox and Hyperv don't work together. Since you are using docker quickstart terminal you should be using VirtualBox for the VM
$ docker-machine create -d virtualbox swarmanager1
$ docker-machine create -d virtualbox nodes1
$ docker-machine create -d virtualbox nodes2
Once done you switch to manager node
$ eval $(docker-machine env swarmanager1)
$ docker swarm init --advertise-addr eth0
This will give you a token command and you need to execute them for each node
$ eval $(docker-machine env nodes1)
$ docker <swarm command from manager>
I am trying to change the storage driver to devicemapper on mac. and was following the steps in Change docker storage driver on Mac OS X
but I got the following error, my docker for mac is latest version.
$ docker-machine create --driver virtualbox --engine-storage-driver devicemapper test2
Running pre-create checks...
Creating machine...
(test2) Copying /Users/weiwang/.docker/machine/cache/boot2docker.iso to /Users/weiwang/.docker/machine/machines/test2/boot2docker.iso...
(test2) Creating VirtualBox VM...
(test2) Creating SSH key...
(test2) Starting the VM...
(test2) Check network to re-create if needed...
(test2) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Error creating machine: Error checking the host: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.105:2376": read tcp 192.168.99.1:49168->192.168.99.105:2376: read: connection reset by peer
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.
Note: Please read the updated
Devicemapper is not supported anymore.
You can use overlay which is also pretty good.
Usage:
docker-machine create --driver virtualbox --engine-storage-driver overlay test2
Edit:
My initial comment didn't answer the question correctly. After some more research into how the devicemapper storage driver works it turns out that the default boot2docker base OS docker-machine uses doesn't support the devicemapper storage driver.
Here's a list of supported distros:
RHEL/CentOS/Fedora
Ubuntu 12.04
Ubuntu 14.04
Debian
More detailed information can be found here.
So to solve the issue, you need to install one of the mentioned distros in a VM. Add a SSH server and a passwordless sudo user that can run commands without a tty.
I tried this out by installing a CentOS VM in VirtualBox, adding a NAT and a Host-only driver ( NAT for downloading packages of the internet, and a Host only adapter for a private network that docker-machine and the VM can communicate in. )
After setting up the VM, you can use the following command to connect it to docker-machine. docker-machine will ssh into the VM and check if the Docker Engine is installed. If that's not the case, it will be automatically downloaded and configured.
docker-machine create \
--driver generic \
--generic-ip-address=192.168.58.14 \
--generic-ssh-port 22 \
--generic-ssh-key ~/.ssh/id_rsa \
--engine-storage-driver devicemapper \
docker-centos
More info on using the generic driver here:
https://docs.docker.com/machine/drivers/generic/
Hope this is helps you a bit more on the way than the initial answer :)
After update to docker-machine, I have no idea how to update DOCKER_OPTS in a local boot2docker docker-machine and save it permanently
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM
dev * virtualbox Running tcp://192.168.99.100:2376
I tried to ssh into vm with docker-machine ssh dev, and update /etc/docker/default. But the changes I made are dropped after restart VM with docker-machine restart dev.
If you'd simply like to pass arguments to docker, add them to EXTRA_ARGS in /var/lib/boot2docker/profile. For example:
EXTRA_ARGS='
--label provider=virtualbox
--insecure-registry=10.0.0.1:5000
'
The docker process is started via /etc/init.d/docker which sources /var/lib/boot2docker/profile. $EXTRA_ARGS is passed transparently to the docker process towards the end of start().
As of docker-machine 0.5.0, the mirror can be provisioned with --engine-registry-mirror
docker-machine create -d virtualbox --engine-registry-mirror http://mirror.dockerhub.com dev
--engine-registry-mirror [--engine-registry-mirror option --engine-registry-mirror option] Specify registry mirrors to use