Install Docker And Docker Compose On Ubuntu

This was very useful for me in few of my projects which I used Ansible, Docker and Docker Compose, so I thought to share this in a post to show that How to install Docker and Docker Compose using an Ansible Playbook.

In this Ansible playbook I followed below tasks to complete the Docker installation


To run Compose as a non-root user, see Manage Docker as a non-root user. Install Compose. Follow the instructions below to install Compose on Mac, Windows, Windows Server 2016, or Linux systems, or find out about alternatives like using the pip Python package manager or installing Compose as a container. Install a different version.

  • This will make sure you can run composer, setup the ppa repository so you can install and update it, and finally install docker. If you want to run docker as non root users you will need to run the linux post install steps (opens new window). Here is another one-liner to do so - since you are using ubuntu and all 😉.
  • Sep 23, 2021 Docker Compose is a great tool for development, testing, and staging environments, as well as CI workflows. Install Docker Compose on RHEL 8 / CentOS 8. Follow our separate guide on installation of latest Docker Compose on Linux. Install Docker Compose on Linux. For the sake of keeping this guide brief, we won’t dive into Docker compose usage.
  • Install docker packages
  • Add Docker s official GPG key
  • Verify that we have the key with the fingerprint
  • Set up the stable repository
  • Update apt packages
  • Install docker
  • Add remote “ubuntu” user to “docker” group
  • Install docker-compose

Read More:Stern Aggregated Multiple Log Tailing Tool For Kubernetes

Here is the complete Ansible Playbook for the Docker Installation

Install Docker And Docker Compose On UbuntuUbuntu

Install Docker And Docker Compose On Ubuntu 16.04


Install Docker And Docker-compose On Ubuntu

I hope this will help you for any deployment or automation tasks with Ansible and Docker.