Ubuntu doesn’t come natively shipped with Docker.
If you need to use Ubuntu, you can run the following commands to get it installed on your EC2 instance, in this order:
Sudo yum install git
sudo yum update -y
sudo yum install -y docker
sudo service docker start
sudo usermod -a -G docker ec2-user
sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
Git clone branch
which docker-compose up
Alternatively, you can look at using Core OS, which gets shipped with Docker installed.
Are you here because you realized RHEL8 stopped supporting Docker natively because of the cgroups v2 change? Well Podman is your next alternative, until Docker updates their innerds to support the new change!