How to Install and Configure Docker on Alibaba Cloud ECS Instance

This article explains how to install and configure Docker on the Alibaba Cloud ECS instance.

Docker is an open-source platform from the Moby Project that helps package the applications into containers and automate the deployment. You can deliver the application quickly since you can separate your applications from your infrastructure. Docker offers two versions: Docker Community Edition (CE) and Docker Enterprise Edition (EE). Docker CE is available in the Docker Store and can run on Debian, macOS, CentOS, Windows 10, and cloud platforms. Docker EE is the premium version of Docker CE for enterprises.

You can read the article on Containers and How to Choose Your Container Platform to also understand more about containers.


In this article, we suppose that you already possess an Alibaba Cloud ECS instance with the following latest image available when writing this article:

  •  Ubuntu 20.04
  •  Debian 9.9
  •  CentOs 8.5
  •  Alibaba Cloud Linux 3.2104 64-bits

Installing Docker

We will show you how you can install Docker on the previous images listed above

Installing on Debian 9.9 and Ubuntu 20.04

First, update the cache of the server:

$ sudo apt update

Set up the repository over HTTPS:

$ sudo apt install ca-certificates curl gnupg lsb-release

Add the official Docker GPG key:

$ curl -fsSL | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Set the stable repository of Docker:

  • On Ubuntu 20.04

$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] 
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

  • On Debian 9.9

$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg]
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Update the cache again:

$ sudo apt update

Now, you can install Docker Engine:

$ sudo apt-get install docker-ce docker-ce-cli

You can check if the service is running by running the following command:

$ sudo systemctl status docker

Add the default user to the docker group so that will not need to use the `sudo` command with docker:

$ sudo usermod -aG docker franck

Installing on Centos 8.5

Install the `yum-utils` package to have the `yum-config-manager`:

$ sudo yum install -y yum-utils

Install the docker stable repository with the `yum-config-manager` utility:

$ sudo yum-config-manager --add-repo

Install docker-engine:

$ sudo yum install docker-ce docker-ce-cli

Start the docker service:

$ sudo systemctl start docker

Check if the service has started properly:

$ sudo systemctl status docker

Add your user to the docker group:

$ sudo usermod -aG docker franck

Installing on Alibaba Cloud Linux 3

Add the DNF repository of Docker-CE:

$ sudo dnf config-manager --add-repo=

Install the Docker-CE package:

$ sudo dnf -y install docker-ce --nobest

Make sure to start the docker service:

$ sudo systemctl start docker

Don’t forget to add your Linux user to the docker group:

$ sudo usermod -aG docker franck


When you install docker without adding your user to the docker group, you will need to use the `sudo` command to run any docker command every time. That is why in all steps, we remember you to add your user to the docker group.

Leave a Comment

Scroll to Top