Install the Docker Engine and Docker Compose on Linux

Exported on 04-Sep-2021 21:11:19

Install and Configure Docker on Linux

This blueprint is for the installation and configuration of Docker Engine and Docker Compose.

This has been tested on Raspberry Pi 4 with Ubuntu Server 20.04.2 LTS 64-bit.

Docker Engine

Docker Engine is an open source containerization technology for building and containerizing your applications. This blueprint installs the Docker Engine.

Docker Compose

Docker Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. This blueprint installs Docker Compose.

Parameters

Name Type Script Reference Default Value Comment
Linux Node Linux / Unix Server linuxNode
Linux User Linux OS Credential linuxUser

1 - Node Patching - Linux

Update the package lists and upgrade the packages.

1.1 - NP Update Package Lists

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
apt-get update

1.2 - NP Upgrade Packages

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
apt-get upgrade -y

2 - ICD Install Docker

Install the Docker Engine.

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
apt install docker -y

3 - IICD Install Docker Compose

Install Docker Compose.

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
apt install docker-compose -y

4 - ICD Create Docker Group and Add User

Create the Docker Group and add the non-root user that requires Docker access.

This step has the following parameters

Name Script Reference Default Value
Linux User {LinuxUser.user} None

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
groupadd docker

usermod -aG docker {LinuxUser.user}

cat /etc/group | grep docker

5 - ICD Set the User Group to Docker

Activate the changes to the Docker group.

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
newgrp docker

groups

6 - Restart Linux Node

Shutdown the node with the reboot flag set and wait until the node has rebooted by checking it was down for two seconds and is active on port 22.

6.1 - Shutdown Node with Restart Flag

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
shutdown -r now

6.2 - Is Node Up

The connection details have changed from the last step.

on node

Check if tcp port 22 is listening make sure it goes down for 2 seconds .

Use Telnet to check if the TCP service is accepting connections.

7 - ICD Start and Enable Docker

Configure Docker to start on boot and start the Docker engine.

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
systemctl enable docker

systemctl start docker

systemctl status docker

8 - ICD Docker Info

Record the Docker system wide information in the log.

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
docker info