Docker Swarm : Labs : Docker service Task 02 Failing

hi @KodeKloud

Can you please create a seperate thread “Docker Swarm” so that we can post all issues related to Docker swarm under that thread ? Currently the thread I am able to see is “Docker for beginners”.

Anyway This is wrt Docker Swarm : Labs : Docker service Task 02 Failing

Can you please go through below outputs and let me know why the checks are failing in below attempt ? I have included all necessary outputs for your kind analysis.

==================================
Question

Let’s initialize a swarm cluster on the node master , once done add node01 to the cluster

you can ssh to node01 from master node

CHECK

  • info_outline Hint

run docker swarm init

===================================

Checks

  • Tasks not completed!

  • node master is the leader?

  • node01 joined swarm as a worker?

===================================

Terminal Output

node01 node01 docker swarm join --token SWMTKN-1-3wbn6cuxhzz5gxnxsqmecwfrso15ll6pck04r44enszl2d5b8b-ckwrwxwsxplimmo4pqoov3w2s 172.17.0.36:2377
This node joined a swarm as a worker.
node01 $exit

master $ docker node lsID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
biaj19oh7dvgewcvcooqdedex node01 Ready Activelyau67dhohblb2aonhqi66qh2 * master Ready Active Leader
master $master

$ docker node inspect bi
[ {
“ID”: “biaj19oh7dvgewcvcooqdedex”, “Version”: {
“Index”: 15 },
“CreatedAt”: “2020-06-23T18:19:37.880130684Z”, “UpdatedAt”: “2020-06-23T18:19:38.528486062Z”,
“Spec”: {
“Role”: “worker”,
“Availability”: “active”
},
“Description”: {
“Hostname”: “node01”,
“Platform”: {
“Architecture”: “x86_64”,
“OS”: “linux”
},
“Resources”: {
“NanoCPUs”: 4000000000,
“MemoryBytes”: 4143312896
},
“Engine”: {
“EngineVersion”: “1.13.1”,
“Plugins”: [
{
“Type”: “Network”,
“Name”: “bridge”
},
{
“Type”: “Network”,
“Name”: “host”
},
{
“Type”: “Network”,
“Name”: “macvlan”
},
{
“Type”: “Network”,
“Name”: “null”
},
{
“Type”: “Network”,
“Name”: “overlay”
},
{
“Type”: “Volume”,
“Name”: “local”
}
]
}
},
“Status”: {
“State”: “ready”,
“Addr”: “172.17.0.41”
}
}
]

master $

master $ docker node inspect ly
[
{
“ID”: “lyau67dhohblb2aonhqi66qh2”,
“Version”: {
“Index”: 9
},
“CreatedAt”: “2020-06-23T18:17:19.388870316Z”,
“UpdatedAt”: “2020-06-23T18:17:19.991820387Z”,
“Spec”: {
“Role”: “manager”,
“Availability”: “active”
},
“Description”: {
“Hostname”: “master”,
“Platform”: {
“Architecture”: “x86_64”,
“OS”: “linux”
},
“Resources”: {
“NanoCPUs”: 4000000000,
“MemoryBytes”: 2097025024
},
“Engine”: {
“EngineVersion”: “1.13.1”,
“Plugins”: [
{
“Type”: “Network”,
“Name”: “bridge”
},
{
“Type”: “Network”,
“Name”: “host”
},
{
“Type”: “Network”,
“Name”: “macvlan”
},
{
“Type”: “Network”,
“Name”: “null”
},
{
“Type”: “Network”,
“Name”: “overlay”
},
{
“Type”: “Volume”,
“Name”: “local”
}
]
}
},
“Status”: {
“State”: “ready”,
“Addr”: “127.0.0.1”
},
“ManagerStatus”: {
“Leader”: true,
“Reachability”: “reachable”,
“Addr”: “172.17.0.36:2377”
}
}
]

master $ docker swarm init
Error response from daemon: This node is already part of a swarm. Use “docker swarm leave” to leave this swarm and join another one.

master $

hi @KodeKloud

I logged into the node01 and left the swarm .
I logged into master and left the swarm with --force to retry the lab.

This is the second attempt from start.

Can you please help me understand the error or what is being missed here ?
Why the checks are not passed in this 2nd attempt ?

I am not interested in just seeing the output where this passes when you do this lab . What I am looking forward is what mistakes I am doing , what errors are present and how to remove them in order to make this pass properly or are there any environment issues which are beyond my control at present ?

==================================

Q
Let’s initialize a swarm cluster on the node master , once done add node01 to the cluster

you can ssh to node01 from master node

CHECK

  • info_outline Hint

run docker swarm init

================================================

CHECKS:

  • Tasks not completed!

  • node master is the leader?

  • node01 joined swarm as a worker?

===========================================

Terminal Output:

master docker node ls Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again. master

master $ docker swarm init
Swarm initialized: current node (9kk02ludh2wnf2oj8fhcfgyun) is now a manager.
To add a worker to this swarm, run the following command:

docker swarm join \
--token SWMTKN-1-2zkt0x7c4ioywo0enjlma6j2c7nmss33cvvpo8q9y3auim778x-c6qsi80fdqa74zay245r01iex \
172.17.0.36:2377

To add a manager to this swarm, run ‘docker swarm join-token manager’ and follow the instructions.

master $

master docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS 9kk02ludh2wnf2oj8fhcfgyun * master Ready Active Leader master

master ssh node01 node01
node01 $ docker swarm join --token SWMTKN-1-2zkt0x7c4ioywo0enjlma6j2c7nmss33cvvpo8q9y3auim778x-c6qsi80fdqa74zay245r01iex \

172.17.0.36:2377

This node joined a swarm as a worker.
node01 $

node01 $ docker swarm join
“docker swarm join” requires exactly 1 argument(s).
See ‘docker swarm join --help’.

Usage: docker swarm join [OPTIONS] HOST:PORT
Join a swarm as a node and/or manager
node01 $

node01 $ exit
logout

Connection to node01 closed.
master $

master docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS 9kk02ludh2wnf2oj8fhcfgyun * master Ready Active Leader n6ie0y15mq0nun2t4kwugata8 node01 Ready Active master

master $ docker node inspect 9k

[
{
“ID”: “9kk02ludh2wnf2oj8fhcfgyun”,
“Version”: {
“Index”: 9
},
“CreatedAt”: “2020-06-23T18:41:41.941202755Z”,
“UpdatedAt”: “2020-06-23T18:41:42.750017269Z”,
“Spec”: {
“Role”: “manager”,
“Availability”: “active”
},
“Description”: {
“Hostname”: “master”,
“Platform”: {
“Architecture”: “x86_64”,
“OS”: “linux”
},
“Resources”: {
“NanoCPUs”: 4000000000,
“MemoryBytes”: 2097025024
},
“Engine”: {
“EngineVersion”: “1.13.1”,
“Plugins”: [
{
“Type”: “Network”,
“Name”: “bridge”
},
{
“Type”: “Network”,
“Name”: “host”
},
{
“Type”: “Network”,
“Name”: “macvlan”
},
{
“Type”: “Network”,
“Name”: “null”
},
{
“Type”: “Network”,
“Name”: “overlay”
},
{
“Type”: “Volume”,
“Name”: “local”
}
]
}
},
“Status”: {
“State”: “ready”,
“Addr”: “127.0.0.1”
},
“ManagerStatus”: {
“Leader”: true,
“Reachability”: “reachable”,
“Addr”: “172.17.0.36:2377”
}
}
]
master $

master $ docker node inspect n6

[
{
“ID”: “n6ie0y15mq0nun2t4kwugata8”,
“Version”: {
“Index”: 15
},
“CreatedAt”: “2020-06-23T18:42:26.662849624Z”,
“UpdatedAt”: “2020-06-23T18:42:27.148900232Z”,
“Spec”: {
“Role”: “worker”,
“Availability”: “active”
},
“Description”: {
“Hostname”: “node01”,
“Platform”: {
“Architecture”: “x86_64”,
“OS”: “linux”
},
“Resources”: {
“NanoCPUs”: 4000000000,
“MemoryBytes”: 4143312896
},
“Engine”: {
“EngineVersion”: “1.13.1”,
“Plugins”: [
{
“Type”: “Network”,
“Name”: “bridge”
},
{
“Type”: “Network”,
“Name”: “host”
},
{
“Type”: “Network”,
“Name”: “macvlan”
},
{
“Type”: “Network”,
“Name”: “null”
},
{
“Type”: “Network”,
“Name”: “overlay”
},
{
“Type”: “Volume”,
“Name”: “local”
}
]
}
},
“Status”: {
“State”: “ready”,
“Addr”: “172.17.0.41”
}
}
]
master master

================================================

hi @KodeKloud

This time I left the lab and logged on again to restart the lab . Still I am not able to understand what is causing failure in the checks .

========================================

                 ALL SET!

master master
master master docker node ls
Error response from daemon: This node is not a swarm manager. Use “docker swarm init” or “docker swarm join” to connect this node to swarm and try again.
master master
master date Tue Jun 23 18:53:12 UTC 2020 master
master pwd /root master
master whoami root master
master $ docker swarm init
Swarm initialized: current node (n624mz6oef7f5dk0ww54bnfrl) is now a manager.

To add a worker to this swarm, run the following command:

docker swarm join \
--token SWMTKN-1-0vu611nmedt22qym07jdpyajo1i6pbh7j2zesmjozhhriusm7f-c4q1gkn3dmpy6vmk5z7jm5n6i \
172.17.0.22:2377

To add a manager to this swarm, run ‘docker swarm join-token manager’ and follow the instructions.

master master docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
n624mz6oef7f5dk0ww54bnfrl * master Ready Active Leader
master master ssh node01
The authenticity of host ‘node01 (172.17.0.25)’ can’t be established.
ECDSA key fingerprint is SHA256:QcAm6fpeYSCdk+ZK+J4tq1sLG/4P07eaLfe9H9jtTAo.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘node01,172.17.0.25’ (ECDSA) to the list of known hosts.
node01 node01
node01 $ docker swarm join --token SWMTKN-1-0vu611nmedt22qym07jdpyajo1i6pbh7j2zesmjozhhriusm7f-c4q1gkn3dmpy6vmk5z7jm5n6i \

172.17.0.22:2377

This node joined a swarm as a worker.
node01 node01
node01 exit logout Connection to node01 closed. master
master docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS n624mz6oef7f5dk0ww54bnfrl * master Ready Active Leader yz1uezysg19s61hlsy8hxdgsw node01 Ready Active master
master master
master $

master $ docker node inspect n62

[
{
“ID”: “n624mz6oef7f5dk0ww54bnfrl”,
“Version”: {
“Index”: 9
},
“CreatedAt”: “2020-06-23T18:53:21.997373217Z”,
“UpdatedAt”: “2020-06-23T18:53:22.518460275Z”,
“Spec”: {
“Role”: “manager”,
“Availability”: “active”
},
“Description”: {
“Hostname”: “master”,
“Platform”: {
“Architecture”: “x86_64”,
“OS”: “linux”
},
“Resources”: {
“NanoCPUs”: 4000000000,
“MemoryBytes”: 2097025024
},
“Engine”: {
“EngineVersion”: “1.13.1”,
“Plugins”: [
{
“Type”: “Network”,
“Name”: “bridge”
},
{
“Type”: “Network”,
“Name”: “host”
},
{
“Type”: “Network”,
“Name”: “macvlan”
},
{
“Type”: “Network”,
“Name”: “null”
},
{
“Type”: “Network”,
“Name”: “overlay”
},
{
“Type”: “Volume”,
“Name”: “local”
}
]
}
},
“Status”: {
“State”: “ready”,
“Addr”: “127.0.0.1”
},
“ManagerStatus”: {
“Leader”: true,
“Reachability”: “reachable”,
“Addr”: “172.17.0.22:2377”
}
}
]
master master

master master docker node inspect yz1
[
{
“ID”: “yz1uezysg19s61hlsy8hxdgsw”,
“Version”: {
“Index”: 15
},
“CreatedAt”: “2020-06-23T18:54:02.141209786Z”,
“UpdatedAt”: “2020-06-23T18:54:02.437804257Z”,
“Spec”: {
“Role”: “worker”,
“Availability”: “active”
},
“Description”: {
“Hostname”: “node01”,
“Platform”: {
“Architecture”: “x86_64”,
“OS”: “linux”
},
“Resources”: {
“NanoCPUs”: 4000000000,
“MemoryBytes”: 4143312896
},
“Engine”: {
“EngineVersion”: “1.13.1”,
“Plugins”: [
{
“Type”: “Network”,
“Name”: “bridge”
},
{
“Type”: “Network”,
“Name”: “host”
},
{
“Type”: “Network”,
“Name”: “macvlan”
},
{
“Type”: “Network”,
“Name”: “null”
},
{
“Type”: “Network”,
“Name”: “overlay”
},
{
“Type”: “Volume”,
“Name”: “local”
}
]
}
},
“Status”: {
“State”: “ready”,
“Addr”: “172.17.0.25”
}
}
]
master master
master master
master $

================================================

  • Tasks not completed!

  • node master is the leader?

  • node01 joined swarm as a worker?

========================================================

Hi @ppnehe

Thanks for the suggestion.

For the lab problem , your solution is correct but there is an initial problem in the lab itself and we are investigating the problem to solve it.