Skip to content

Instantly share code, notes, and snippets.

@m4r10k
Created December 19, 2017 05:47
Show Gist options
  • Save m4r10k/8d18972dc5c11e76d1804b73c0b3bbef to your computer and use it in GitHub Desktop.
Save m4r10k/8d18972dc5c11e76d1804b73c0b3bbef to your computer and use it in GitHub Desktop.

On manager

###############################################################
#                          WARNING!!!!                        #
# This is a sandbox environment. Using personal credentials   #
# is HIGHLY! discouraged. Any consequences of doing so are    #
# completely the user's responsibilites.                      #
#                                                             #
# The PWD team.                                               #
###############################################################
[manager1] (local) root@172.29.0.5 ~
$ docker network create --driver=overlay --attachable mynet
ch83itazl2fchehvjr019eff3
[manager1] (local) root@172.29.0.5 ~
$ docker service create --replicas 2 --constraint "node.role==worker" --network mynet nginx
c0e3xz3qqvcn344wkk2x0xt0j
Since --detach=false was not specified, tasks will be created in the background.
In a future release, --detach=false will become the default.
[manager1] (local) root@172.29.0.5 ~
$ docker service ps laughing_ramanujan
ID                  NAME                   IMAGE               NODE                DESIRED STATE       CURRENT STATE            ERROR               PORTS
vcgkh7k51j4i        laughing_ramanujan.1   nginx:latest        worker1             Running             Running 10 seconds ago
jb3gzd9nmiib        laughing_ramanujan.2   nginx:latest        worker2             Running             Running 10 seconds ago
[manager1] (local) root@172.29.0.5 ~
$ docker network inspect -v mynet
[
    {
        "Name": "mynet",
        "Id": "ch83itazl2fchehvjr019eff3",
        "Created": "0001-01-01T00:00:00Z",
        "Scope": "swarm",
        "Driver": "overlay",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": []
        },
        "Internal": false,
        "Attachable": true,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": null,
        "Options": {
            "com.docker.network.driver.overlay.vxlanid_list": "4097"
        },
        "Labels": null
    }
]
[manager1] (local) root@172.29.0.5 ~
$

On worker

###############################################################
#                          WARNING!!!!                        #
# This is a sandbox environment. Using personal credentials   #
# is HIGHLY! discouraged. Any consequences of doing so are    #
# completely the user's responsibilites.                      #
#                                                             #
# The PWD team.                                               #
###############################################################
[worker1] (local) root@172.29.0.3 ~
$ docker network inspect -v mynet
[
    {
        "Name": "mynet",
        "Id": "ch83itazl2fchehvjr019eff3",
        "Created": "2017-12-19T05:45:25.932508596Z",
        "Scope": "swarm",
        "Driver": "overlay",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "10.0.0.0/24",
                    "Gateway": "10.0.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": true,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "9e516cf33080403d2520f731d12bd88c0a62a63d471afc5bc1511f4b7e6fc414": {
                "Name": "laughing_ramanujan.1.vcgkh7k51j4i9831bpu645d4p",
                "EndpointID": "7f5542e579f831c06b40d1da74f6a3d4a168e0f985a2b2094b2245a002f2cffa",
                "MacAddress": "02:42:0a:00:00:04",
                "IPv4Address": "10.0.0.4/24",
                "IPv6Address": ""
            }
        },
        "Options": {
            "com.docker.network.driver.overlay.vxlanid_list": "4097"
        },
        "Labels": {},
        "Peers": [
            {
                "Name": "worker1-a81c7d2851dc",
                "IP": "172.29.0.3"
            },
            {
                "Name": "worker2-94ed95ff3b39",
                "IP": "172.29.0.2"
            }
        ],
        "Services": {
            "laughing_ramanujan": {
                "VIP": "10.0.0.2",
                "Ports": [],
                "LocalLBIndex": 256,
                "Tasks": [
                    {
                        "Name": "laughing_ramanujan.1.vcgkh7k51j4i9831bpu645d4p",
                        "EndpointID": "7f5542e579f831c06b40d1da74f6a3d4a168e0f985a2b2094b2245a002f2cffa",
                        "EndpointIP": "10.0.0.4",
                        "Info": {
                            "Host IP": "172.29.0.3"
                        }
                    },
                    {
                        "Name": "laughing_ramanujan.2.jb3gzd9nmiibtlmwrk0zbitm6",
                        "EndpointID": "ad6c475549a9f62e432f4bc6b528eca36eb77aba859367693903064855a1a628",
                        "EndpointIP": "10.0.0.3",
                        "Info": {
                            "Host IP": "172.29.0.2"
                        }
                    }
                ]
            }
        }
    }
]
[worker1] (local) root@172.29.0.3 ~
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment