Docker Swarm – Apply Linux Updates to Node

Exported on 09-Sep-2021 13:19:54

This Attune Blueprint safely stops a docker swarm node, then performs routine maintenance tasks on it to ensure the Linux packages and Docker Packages are up to date.

This maintenance tasks is best run with the built in Attune Scheduler to ensure all nodes have the lates docker swarm security vulnerability patches applied.

Parameters

Name Type Script Reference Default Value Comment
Linux Node Linux / Unix Server linuxNode
Linux User with Sudo Linux OS Credential linuxUserWithSudo This Linux credential should have sudo=root set in the Attune Value

1 - Docker Swarm - Drain Node

Before the Docker Swarm node can be taken down, it should process all the tasks assigned to it. This is a safe way to stop a node in the Docker Swam that ensures no jobs are lost or held up.

The connection details have changed from the last step.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# List the docker nodes
docker node ls

# Drain the node of tasks so it can be taken offline safely  
docker node update --availability drain {swarmNode}

2 - Docker Swarm - Apt Update Node

Perform maintenance on the docker node. Update the Linux packages, including and docker security patches.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Update the host
apt update
apt dist-upgrade -y

3 - Docker Swarm - Activate Node

Enable the node to become an active part of the docker swarm again.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Renable the node
docker node update --availability active {swarmNode}