How to create a custom Docker cluster layout?

Method 1

Method 1 shows how to create docker cluster layout for VMware cloud with Ubuntu 22.04 running the latest version of docker.

Create a Node Type

  1. Create a new node type by navigating to Library > Blueprints > Node Types > +Add

  1. Configure the required fields as shown below

Create a Cluster Layout

  1. Create a new Docker cluster layout by navigating to Library > Blueprints > Cluster Layouts > +Add

  1. Fill in the required fields as shown below. Make sure ‘Install Docker’ is checked, and attach the node from step 2 as the worker node.

The newly created layout will now be available for use when provisioning a Docker cluster. Morpheus will install the latest version of docker on the nodes during provisioning.

Method 2

Method 2 shows how to create docker cluster layout for VMware cloud with Ubuntu 22.04 running a specific version of docker.

Create a Docker installation task

  1. Navigate to Library > Automation > Tasks > +Add.

  1. Create a shell script task that will be executed on the docker node to install specific version of docker. Fill in the required fields as shown below.

On my example I’m using the following shell script to install docker version ‘20.10.17~3-0~ubuntu-jammy’.

#Install Docker Version 20.10.17 on Ubuntu 22.04
yes Y | sudo apt-get update
yes Y | sudo apt-get install ca-certificates
yes Y | sudo apt-get install curl
yes Y | sudo apt-get install gnupg
yes Y | sudo apt-get install lsb-release

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

yes Y | sudo apt-get update

#List the available versions:
#apt-cache madison docker-ce | awk '{ print $3 }'

VERSION_STRING=5:20.10.17~3-0~ubuntu-jammy
yes Y | sudo apt-get install docker-ce=$VERSION_STRING docker-ce-cli=$VERSION_STRING containerd.io docker-compose-plugin

echo $(docker --version)

Create a post provisioning workflow

  1. Navigate to Library > Automation > Workflows > +Add > Provisioning Workflow.

  2. Configure the workflow as shown below and attach the task from step 2.

  1. Follow the steps 1 - 3 from Method 1 to create the node and the layout.

  2. When creating the cluster layout, uncheck the ‘Install Docker’ checkbox, and select the provisioning workflow we created on step 4.

When provisioning with this layout Morpheus will install the docker version specified in the shell task on all of the cluster nodes.

2 Likes