Use docker swarm unlock to unlock the manager
In this step, we will unlock the Docker swarm using the unlock key we obtained in Step 1. This will allow us to interact with the swarm again.
Recall the unlock key that was displayed when you initialized the swarm in Step 1. You will need to provide this key to the docker swarm unlock
command.
Use the docker swarm unlock
command followed by the --unlock-key
flag and the unlock key you copied. Replace YOUR_UNLOCK_KEY
with the actual key.
docker swarm unlock --unlock-key YOUR_UNLOCK_KEY
After executing the command with the correct unlock key, the swarm should be unlocked. You should see output indicating that the swarm was successfully unlocked.
Swarm unlocked.
Now that the swarm is unlocked, let's verify that we can interact with it again by listing the nodes in the swarm.
docker node ls
You should now see the details of the manager node, indicating that the swarm is operational. The output will be similar to this:
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
xxxxxxxxxxxx labex-vm Ready Active Leader 20.10.21
This confirms that you have successfully unlocked the Docker swarm after the daemon restart.