Install Docker Engine (CE) On Ubuntu

By | June 27, 2021

Docker Engine is an open source containerization technology for building and containerizing your applications. Docker Engine acts as a client-server application with:

  • A server with a long-running daemon process dockerd.
  • APIs which specify interfaces that programs can use to talk to and instruct the Docker daemon.
  • A command line interface (CLI) client docker.
Credit to Docker.

1. Demonstration LAB info

  • OS: Ubuntu Server (64-bit of any Ubuntu Server version: 21.04, 20.10, 20.04, 18.04, 16.04)
  • Hostname: UBUDKR
  • IP: 192.168.100.12/24
  • CPU: 2 Cores
  • RAM: 2 GB
  • Disk: 30 GB
  • Need Internet connection

2. Uninstall old Docker Engine Version

Older versions of Docker were called docker, docker.io, or docker-engine. If these are installed, uninstall them:

 sudo apt-get remove \
    docker \
    docker-engine \
    docker.io \
    containerd \
    runc

3. Install Docker Engine (CE)

3.1. Set up the repository

  • Update the apt package index and install packages to allow apt to use a repository over HTTPS:
sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
  • Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  • Use the following command to set up the stable repository:
echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

3.2. Install Docker Engine

sudo apt-get update
sudo apt-get install \
    docker-ce \
    docker-ce-cli \
    containerd.io

3.3. Verify that Docker Engine is installed correctly by running the hello-world image

sudo docker run hello-world
hello-world result

4. Install Docker Compose

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. Then, with a single command, you create and start all the services from your configuration. For more details, refer to Docker Compose. To install docker compose, run the below command:

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

To verify if docker compose installation is ok, run the below command:

sudo docker-compose --version
Docker-compose version

Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *