Wednesday, 8 June 2022

Docker Container Locking in a Swarm Cluster


sudo docker swarm update --autolock=true

Swarm updated.

To unlock a swarm manager after it restarts, run the `docker swarm unlock`

command and provide the following key:


    SWMKEY-1-2ppI868kNB3T0XVZf4PqkFq2TU0xiL+9G1ya8wRhLf4


Please remember to store this key in a password manager, since without it you

will not be able to restart the manager.


sudo systemctl restart docker.service


sudo docker service ls

Error response from daemon: Swarm is encrypted and needs to be unlocked before it can be used. Please use "docker swarm unlock" to unlock it.


sudo docker swarm unlock

Please enter unlock key: 


#to view the current unlock key

sudo docker swarm unlock-key

To unlock a swarm manager after it restarts, run the `docker swarm unlock`

command and provide the following key:


    SWMKEY-1-2ppI868kNB3T0XVZf4PqkFq2TU0xiL+9G1ya8wRhLf4


Please remember to store this key in a password manager, since without it you

will not be able to restart the manager.


#to rotate the unlock key

sudo docker swarm unlock-key --rotate

Successfully rotated manager unlock key.


To unlock a swarm manager after it restarts, run the `docker swarm unlock`

command and provide the following key:


    SWMKEY-1-y+/oFN8p4GmlEHMjuHuLVgBjhF1eTG7IbDyAE8+cQMw


Please remember to store this key in a password manager, since without it you

will not be able to restart the manager.


# To disable auto-locking 

 sudo docker swarm update --autolock=false

Swarm updated.


sudo docker swarm unlock-key

no unlock key is set




No comments:

Post a Comment