Automation: Docker Compose
Posted on December 13, 2021 — 1 Minute Read
While Ansible and Terraform are incredibly handy in server and cloud automation that provision Infrastructure as Code (IaC). For simpler tasks, a good old Bash script is just as useful. Case in point – automating the process of installing Docker and Docker Compose on a Ubuntu Linux Operating System (OS) with a Bash script, for deploying containerised app, takes merely a few lines.
The rest of the code is shared on Github for reference and further development. With the code packaged as a standalone script, deployment is as simple as:
- Download a copy of the script;
- Provide the script with execute permission; and
- Run the script.
Download a copy of the script with
$ git clone https://github.com/kurtcms/docker-compose /app/docker-compose/
Provide the script with execute permission.
$ chmod +x /app/docker-compose/docker-compose.sh
Run the script manually or as part of an automation workflow.
And have Docker Compose installed.
This is just one example of using a simple Bash script to execute and automate commands. There are plenty of other fascinating tasks that can be done and with Bash. Explore and be amazed.