Learn how to install Docker in Ubuntu (64bit) with these simple steps (for other distributions or architectures, see: Install Docker Engine).

  1. Update repositories and install required packages:
    sudo apt-get update
    sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
    
  2. 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
    
  3. Add the 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
    
  4. Install Docker
    sudo apt-get update
    sudo apt-get install docker-ce docker-ce-cli containerd.io
    
  5. Add current user to “docker” group
    sudo usermod -aG docker $USER
    # or
    sudo adduser $USER docker
    

Now you can run containers, for example:

docker run -p 8080:80 nginx

To install Docker Compose, check https://docs.docker.com/compose/install/.

If you have any suggestion, feel free to contact me via social media or email.