7,540
edits
Changes
→Create the machine
'''Dual Network''':<br>
* '''eth1''' - A host private network called '''docker-machines ''' is automatically created to ensure we always have connectivity to the VMs. ** The docker-machine ip command will always return this IP address which is only accessible from your local system. ** That network is to be used for the swarm management, node to node communication (as this data is very sensitive), so this ip has to be provided in the '''--advertise-addr''' parameter in the "'''docker swarm init'''" or in the "'''docker swarm join'''" command.* '''eth0''' - You can specify any libvirt named network. If you don't specify one, the "default" named network will be used.If you have exotic networking topolgies (openvswitch, etc.), you can use virsh edit mymachinename after creation, modify the first network definition by hand, then reboot the VM for the changes to take effect.** Typically this would be your "public" network accessible from external systems** To retrieve the IP address of this network, you can run a command like the following:<pre>docker-machine ssh mymachinename "ip -one -4 addr show dev eth0|cut -f7 -d' '"</pre>
Driver Parameters:<br>
<br>
==Install softwares==
Secondly we have to install the hypervisor driver for the docker-machine to be able to create, manage Virtual Machines running on the hypervisor. As we are going to use the KVM hypervisor, we have to install the "docker-machine-driver-kvm" driver:
{{warning|Fontos, hogy a 10-es verziójú KVM driver ami a CentOS7-hez való nem kompatibilis a Fedora 26-al. Én végül továbbra is a 7-es verziót használom, ez továbbra is jó}}
<pre>
# curl -Lo docker-machine-driver-kvm \
If the new VM was created with virtualbox driver, the VirtualBox graphical management interface must be started with the same user, that the VM was created with, and the VirtualBox will discover the new VM automatically}}
{{warning|A 18.9-es boot2docker nem kompatibilis a Fedora-s docker-machine-al, mert valamiért nem nem érzékeli, hogy az SSH már elindult (Waiting for SSH to be available...). Töltsük le a boot2docker_v18.06.1, és azzal már működik. A --kvm-boot2docker-url-el kell megadni a letöltött ISO-t. }}
<pre>
# docker-machine create -d kvm --kvm-network "docker-network" --kvm-boot2docker-url="/home/adam/Downloads/boot2docker/boot2docker-v18.05.0-ce.iso" --kvm-disk-size "5000" --kvm-memory "800" mg0
# docker-machine create -d kvm --kvm-network "docker-network" --kvm-boot2docker-url="/root/.docker/machine/cache/boot2docker_v18.06.1-ce.iso" --kvm-disk-size "5000" --kvm-memory "800" mg0
</pre>
===Use different OS===
Az operációs rendszert esősorban a driver típusa határozza meg. A KVM driver-hez alapértelmezetten a boot2docker OS tartozik. Azonban bármilyen más boot2docker alapú oprendszert is használhatunk. Az Amazon AWS driver használata esetén Ubuntu lesz az OS.
KVM driver esetén ha nem az alapértelmezett OS-t akarjuk használni, akkor a --kvm-boot2docker-url kapcsolóval kell megadni a .ISO helyét. Én a rancherOS-t próbáltam ki és működött. Innen lehet letölteni: https://github.com/rancher/os (közvetlen link: https://releases.rancher.com/os/v1.5.0/rancheros.iso)
<pre>
docker-machine create -d kvm --kvm-boot2docker-url "/home/adam/Downloads/rancheros.iso" --kvm-network "docker-network" manager1
</pre>
===Check what was created===
eth1 inet addr:192.168.42.118 Bcast:192.168.42.255 Mask:255.255.255.0
</pre>
* '''eth0''':192.168.123.195 - Interface to the new virtual network (docker-network) created by us. this network is connected to the host network,so it has public internet access as well. (the network was created with "'''forward mode=nat'''", see [[KVM#Add new network]] for details)
* '''eth1''':192.168.42.118 - This connect to the dynamically created host-only virtual network. Just for VM-to-VM communication
* '''docker0''':172.17.0.1 - This VM is ment to host docker container, so the docker daemon was already installed and started on it. Form docker point of view, this VM is also a (docker) host, and therefore the docker daemon created the default virtual bridge, that the containers will be connected to unless it is specified implicitly otherwise during container creation.
====IPtables modifications====
:[[File:ClipCapIt-180623180827-010335231807.PNG|800px]]
<br>
<pre>
</pre>
<br>
<pre>
-A FORWARD -i virbrDocker -o virbrDocker -j ACCEPT