LAMP Consortium

Issue with Docker Swarm setup on AWS

Hello,

I am trying to deploy mindLamp server on AWS provided by MGB. I believe I completed the most of the steps instructed on the ‘Preparing Resources on AWS’ page except I ran into an issue on the last step.

docker swarm join --token SWARM_TOKEN IP_ADDR:2377

[ec2-user@mindlamp ~]$ sudo yum install docker
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core                                                                                                                                     | 3.7 kB  00:00:00     
Package docker-20.10.7-1.amzn2.x86_64 already installed and latest version
Nothing to do
[ec2-user@mindlamp ~]$ hostnamectl 
   Static hostname: mindlamp.itpmclean.org
         Icon name: computer-vm
           Chassis: vm
      
[ec2-user@mindlamp ~]$ sudo service docker start
Redirecting to /bin/systemctl start docker.service
[ec2-user@mindlamp ~]$ sudo docker swarm join --token SWARM_TOKEN IP_ADDR:2377
Error response from daemon: This node is already part of a swarm. Use "docker swarm leave" to leave this swarm and join another one.

This is what my security group setting look like.

For example, I understood the step where ‘Docker Swarm: TCP 2377 from this Security Group’ as use custom TCP with port range 2377 and set the source to default (which is the name of the security group)

Do you know how to check and properly troubleshoot where I have to start and join the Swarm?
Or perhaps the last error message means I already joined successfully?

Thank you!
Yoon

I realized SWARM_TOKEN and IP_ADDR needs to be replaced!

I wasn’t sure how to retrieve the SWARM_TOKEN so I searched the docker documentation and tried the following.

[ec2-user@mindlamp ~]$ sudo service docker start
Redirecting to /bin/systemctl start docker.service
[ec2-user@mindlamp ~]$  docker swarm join-token worker
To add a worker to this swarm, run the following command:

    docker swarm join --token SWMTKN-1-0r1ndm6kd1fwncb02xrq3nza1aav8vq8a40qyqg8je4avvehzb-8tmxuu06wvp4r5b8nwfgkg9ip 172.31.24.224:2377

[ec2-user@mindlamp ~]$ docker swarm join --token SWMTKN-1-0r1ndm6kd1fwncb02xrq3nza1aav8vq8a40qyqg8je4avvehzb-8tmxuu06wvp4r5b8nwfgkg9ip 172.31.24.224:2377
Error response from daemon: This node is already part of a swarm. Use "docker swarm leave" to leave this swarm and join another one.
[ec2-user@mindlamp ~]$ docker node list
ID                            HOSTNAME                 STATUS    AVAILABILITY   MANAGER STATUS   ENGINE VERSION
nrwc5viiydmdhenvh8h6ongsx *   mindlamp.itpmclean.org   Ready     Active         Leader           20.10.7

Would using docker swarm join-token worker as shown above work in this case? I am still getting the message that I am part of the swarm. Not sure if this means I am set and I can move on to the next step. Can someone verify? Also, the return message after docker node list is shown above.