What are the vm-driver and driver falgs in Minikube? - macos

I am using Minikube in macOS.
I found this in ~/.minikube/config/config.json:
{
"driver": "docker",
"vm-driver": "hyperkit"
}
What are they, and what is the difference?
Does Minikube use Hyperkit as a virtual machine and run in it? If so, why do it needs the driver settings?
Also, I see a lot of minikube start with:
--docker-env http_proxy=url
--docker-env https_proxy=url
--docker-env no_proxy=url
there are the proxy settings in the docker settings (that is, the proxy settings in the dashboard in docker desktop for mac), are these parameters not needed if the driver is set to docker?
And does the proxy in docker refer to the network environment in hyperkit? Because I think docker pull and push are done in docker daemon, which is running on hyperkit.

I also was confused about the difference betwenn --vm-driver and --driver, and I found that --vm-driver is the old name and it is deprecated, and today --driver is the correct option

Any environment set using --docker-env will go to the docker daemon service. And vm-driver is which hypervisor to use. If you run minikube start --help you will find below information
--driver='': Driver is one of: virtualbox, parallels, vmwarefusion, hyperkit, vmware, docker, podman
So you can use any of above drivers to start your k8s cluster.

Related

docker daemon not connecting

I am new to docker. On Mac OSX I installed docker and docker-machine and ran the following based on what I saw elsewhere online and on stackoverflow. Why is the daemon not connecting? Do I need to change my config to unix sockets for communications? Did I start my docker daemon correctly via docker-machine?
docker-machine create --driver virtualbox default
...
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: docker-machine env default
..
docker run debian echo "Hello World"
docker: Cannot connect to the Docker daemon at
unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
To see how to connect your Docker Client to the Docker Engine running
on this virtual machine, run: docker-machine env default
The command you're missing is eval "$(docker-machine env default)" which will update your environment with $DOCKER_HOST and $DOCKER_TLS_VERIFY settings you can use to connect to the daemon.
One possible reason could be change in your IP address.
simply restart the docker (click on the right-top of your screen a docker-whale). Then again try to run the docker. Use Docker desktop app for mac

Docker localhost process not working on Windows

I am using Docker Quickstart Terminal to run a docker container. The container should work on port 8088 of localhost:
docker run -it --name myContainer -p 8088:8088
However, when I go to localhost:8088 or 127.0.0.1:8088 I can't find any process running.
This works on OSX.
Why is this not working on Windows?
I'm assuming you're using VirtualBox, since that's what is integrated with the Quickstart terminal.
The reason it doesn't work is that Windows isn't running your (Linux) containers natively, it's running them in a separate Linux-based VM. This VM is available under a different ip address than your "physical" machine, usually printed when you start the quickstart terminal:
This is the ip address you need to use in order to connect to published container ports.
One possibility is the kind of VM you are using : HyperV (Docker For Windows) or VirtualBox (Docker Toolbox).
If it is the later (which seems probable since you are using the Docker Quickstart Terminal), you need to port forward 8088 in order for your PC (localhost) to see it.
See "How do I configure docker compose to expose ports correctly?" as an example when using VirtualBox.
If localhost does not work, a docker-machine ip will show you the ip of the VM being executed.

Create a Docker Container using VirtualBox on Windows for Kubernetes

I'm starting to experiment with Kubernetes on my Windows 10 dev machine. I've got minikube running on my machine, with some "canned" test services, so it looks like Kubernetes is working properly.
Now I'm trying to create my first service by following this: http://kubernetes.io/docs/hellonode/
The problem is I can't build the docker image. I get an error that basically says docker isn't running. I've installed the docker toolkit, and I've looked at docker for windows, but it needs hyper-v which doesn't work with Kubernetes (it requires VirtualBox). So is there any way I can get docker running on windows using VirtualBox?
Once you have the docker client on your host windows machine, you can run
minikube docker-env --shell powershell
That will point the docker client on your host to the docker daemon inside the minikube VM.

Not able to access tomcat application on Docker VM with host(windows) IP while using docker toolbox

I am running docker on my windows system using docker toolbox. I ran tomcat container using command docker run -it --rm -p 8888:8080 tomcat:8.0. As per documentation I should be able to access tomcat using http://localhost:8888, but this is not working.
Rather, I can access the tomcat app using docker-machine ip which is http://192.168.99.100:8888.
But this is not what I need. I need to access the tomcat container app from outside my system itself, through the network. So, how do I map tomcat application to my windows host system ?
While googling around, I could see an option of port-forwarding for boot2docker vm. But, again I am not using boot2docker. I am using docker toolbox.
Finally, I was able to find where to add the port-forwarding rule. Open the oracle VirtualBox Manager. Go to Settings-->Network --> Port Forwarding..
Here 1 rule is already available for ssh.
So I added another rule for this with below configurations:
HostIP:HostPort=> 127.0.0.1:9999
GuestIP:GuestPort=> :8888
So now if I invoke http://localhost:9999 , it is forwarded to => docker-machine:8888 and from there it is forwarded to => tomcatVM:8080.
I could see an option of port-forwarding for boot2docker vm. But, again I am not using boot2docker. I am using docker toolbox.
Yes, you are using boot2docker.
Toolbox is just a bundle of boot2docker + docker-machine + kitematic.
Open your VirtualBox, and you will see a VM which, in the storage settings, is based on boot2docker.iso.
See do port-forward 8888 to your host: see "Connect to a Service running inside a docker container from outside"
VBoxManage controlvm "default" natpf1 "tcp-port8888,tcp,,8888,,8888"
VBoxManage controlvm "default" natpf1 "udp-port8888,udp,,8888,,8888"
(Replace default with the name of your docker-machine: see docker-machine ls)

Can't connect to Docker containers on OSX

I'm new to Docker, and I can't seem to connect to any containers.
I installed Docker Toolbox. Now I'm trying to get Shipyard to work. I followed the steps inside of a Docker Quickstart Terminal. The instructions say:
Once deployed, the script will output the URL to connect along with credential information.
The Shipyard installer ended with:
Shipyard available at http://10.0.2.15:8080
Username: [elided] Password: [elided]
However, I went to http://10.0.2.15:8080 on my browser and it didn't connect.
In another Docker Quickstart Terminal, I did a docker ps to see what the container was and to get its IP Address and I got:
$ docker inspect a4755 | grep IPAddress
"SecondaryIPAddresses": null,
"IPAddress": "172.17.0.8",
"IPAddress": "172.17.0.8",
I'm not sure why the IP was different, but I tried to connect to http://172.17.0.8:8080 and this didn't work either. http://localhost:8080 also failed.
This also happened when I tried to run docker-gunicorn-nginx - everything started, but I couldn't connect to the machine.
What gives?
If you read through Docker's Installation on Mac OS X you'll see that on OSX, Docker containers don't run on the host machine itself:
In a Docker installation on Linux, your physical machine is both the localhost and the Docker host. In networking, localhost means your computer. The Docker host is the computer on which the containers run.
On a typical Linux installation, the Docker client, the Docker daemon, and any containers run directly on your localhost. This means you can address ports on a Docker container using standard localhost addressing such as localhost:8000 or 0.0.0.0:8376.
[...]
In an OS X installation, the docker daemon is running inside a Linux VM called default. The default is a lightweight Linux VM made specifically to run the Docker daemon on Mac OS X. The VM runs completely from RAM, is a small ~24MB download, and boots in approximately 5s.
In OS X, the Docker host address is the address of the Linux VM. When you start the VM with docker-machine it is assigned an IP address. When you start a container, the ports on a container map to ports on the VM. To see this in practice, work through the exercises on this page.
Indeed, opening a new Docker Quickstart Terminal, I see:
docker is configured to use the default machine with IP 192.168.99.100
And, opening http://192.168.99.100:8080 takes me to Shipyard. Success!
You can try and execute this command:
docker-machine ip default
it will return some thing like:
192.168.99.100
To get port number:
docker ps
Example output (scroll right to see port mapping):
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
113346425f20 springio/spring1 "sh -c 'java $JAVA_OP" 34 minutes ago Up 34 minutes 0.0.0.0:8080->8080/tcp pensive_kirch
To verify if it is working do:
curl 192.168.99.100:8080

Resources