DEV Community

How to install docker using Linux terminal?

  1. In the ssh terminal, enter the following command to install the yum-utils package:
sudo yum install -y yum-utils
Enter fullscreen mode Exit fullscreen mode

The yum-utils package includes a handy utility for adding package repositories that you will use next.

  1. Enter the following to add the Docker CE package repositories to your system:
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Enter fullscreen mode Exit fullscreen mode
  1. Enter the subsequent command to update the yum cache with the Docker repositories:
sudo yum makecache
Enter fullscreen mode Exit fullscreen mode
  1. Enter the following to install Docker CE:
sudo yum -y install docker-ce libseccomp
Enter fullscreen mode Exit fullscreen mode
  1. Enter the command below to start Docker as a service:
sudo systemctl start docker
Enter fullscreen mode Exit fullscreen mode
  1. Verify Docker is running by entering:
sudo docker info
Enter fullscreen mode Exit fullscreen mode

This will output system-wide information about Docker. The information will resemble the following:

alt
Enter fullscreen mode Exit fullscreen mode

You can see some useful information, such as the number of containers, and the version of the Docker server. Docker adopts a client-server architecture, so the server doesn't have to be running on the same host as the client. In your case, you are using the Docker command line interface (CLI) client to connect to the server, called the Docker daemon.

Top comments (5)

Collapse
 
justplegend profile image
JPL

If I want to install on Linux Mint, just instead of "yum" , I need to use "apt" because is debian based. DId you try it in Linux Mint these steps?

Collapse
 
jimmymcbride profile image
Jimmy McBride

To install docker with apt, this is how I do it:

sudo apt install apt-transport-https ca-certificates curl gnupg lsb-release -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
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
sudo apt update -y
sudo apt install docker-ce docker-ce-cli containerd.io -y
Enter fullscreen mode Exit fullscreen mode

So of the commands might need to use sudo. I can't remember which ones do.

Collapse
 
justplegend profile image
JPL

Thanks, I will try and test it which one might need to use sudo, probably then write article step by step. Thanks Jimmy.

Collapse
 
samiullahsaleem profile image
Sami Ullah Saleem

No! I didn't try it yet brother!

Collapse
 
justplegend profile image
JPL

Ok, thanks. I will try it and test to be sure is it the same or different. :)