jueves, 11 de julio de 2019

Docker User defined Overlay Network

Docker User defined Overlay Network


 Esta red es recomendada para ambientes productivos.

 Necesitamos tres máquinas virtuales corriendo para nuestro lab. En este caso solo las iniciamos. tenemos ya un swarm y estamos en el master.


bext@bext-VPCF13WFX:~$ docker network create -d overlay mi-overlay
ia90c0boee241j0g58epue14e
 
,,
 
bext@bext-VPCF13WFX:~$ docker service create --name mi-nginx --network mi-overlay \
 --replicas 1 --publish published=8080,target=80 nginx
roj04yaenbgzqf7uuxsnpf9pl
overall progress: 1 out of 1 tasks 
1/1: running   
verify: Service converged 
 
..
 
bext@bext-VPCF13WFX:~$ docker network inspect mi-overlay
[
    {
        "Name": "mi-overlay",
        "Id": "ia90c0boee241j0g58epue14e",
        "Created": "2019-07-12T00:09:24.614784019Z",
        "Scope": "swarm",
        "Driver": "overlay",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "10.0.3.0/24",
                    "Gateway": "10.0.3.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": null,
        "Options": {
            "com.docker.network.driver.overlay.vxlanid_list": "4100"
        },
        "Labels": null
    }
] 
 
bext@bext-VPCF13WFX:~$ docker-machine ssh sw-master "curl http://localhost:8080" 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
<!DOCTYPE html>    0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
100   612  100   612    0     0  45119      0 --:--:-- --:--:-- --:--:-- 47076
 
bext@bext-VPCF13WFX:~$ docker-machine ssh sw-master "docker service ls"
ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
ceyyvah20hxb        mi-nginx            replicated          1/1                 nginx:latest        *:8080->80/tcp

bext@bext-VPCF13WFX:~$ docker-machine ssh sw-worker-1 "curl http://localhost:8080"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
1<!DOCTYPE html>   0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
00   612  100   612    0     0  55941      0 --:--:-- --:--:-- --:--:-- 61200
bext@bext-VPCF13WFX:~$  
..

bext@bext-VPCF13WFX:~$ docker service rm mi-nginx
mi-nginx
bext@bext-VPCF13WFX:~$ docker network rm mi-overlay
mi-overlay


eot

No hay comentarios:

Publicar un comentario