arrow_back
Back

Docker installation: Engine, Desktop, and Linux setup

Andrew Dorokhov Andrew Dorokhov schedule 2 min read
menu_book Table of Contents

This is an instruction of installation Docker on CentOS 7.

Adding the Docker repository

We should download the repository file https://download.docker.com/linux/centos/docker-ce.repo and put it into /etc/yum.repos.d/.

Also, we can do it in a more automatic way using yum-config-manager.

Install the yum-utils package (which provides the yum-config-manager utility) and set up the repository.

sudo yum install -y yum-utils
sudo yum-config-manager \
    --add-repo https://download.docker.com/linux/centos/docker-ce.repo

Installing Docker

The Docker Engine package is called docker-ce.

sudo yum install docker-ce

Package docker-ce-cli will be installed as a dependency.

sudo systemctl start docker
sudo systemctl enable docker

Also, we can install Docker Compose:

sudo yum install docker-compose-plugin

Check installation

sudo docker version

It shows a version of a client and server. Also, it shows a version of Go’s language, that was used during compilation.

Example:

Client: Docker Engine - Community
 Version:           20.10.17
 API version:       1.41
 Go version:        go1.17.11
 Git commit:        100c701
 Built:             Mon Jun  6 23:05:12 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.17
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.11
  Git commit:       a89b842
  Built:            Mon Jun  6 23:03:33 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.6
  GitCommit:        10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
 runc:
  Version:          1.1.2
  GitCommit:        v1.1.2-0-ga916309
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Another way to check installation is to run some container:

sudo docker container run hello-world

Manage Docker without sudo

The Docker daemon binds to a Unix socket instead of a TCP port. By default, that Unix socket is owned by the user root and other users can only access it using sudo.

If you don’t want to preface the docker command with sudo, add users to the group docker. When the Docker daemon starts, it creates a Unix socket accessible by members of the docker group.

sudo usermod -aG docker andrew

Restart Docker:

sudo systemctl restart docker

Log out and log back in so that your group membership is re-evaluated.

Verify that everything works without sudo:

docker run hello-world
code

Need Help with Development?

Happy to help — reach out via the contacts or go straight to my Upwork profile.

work View Upwork Profile arrow_forward
Next Article

Docker Compose: services, networks, volumes, and compose.yml

arrow_forward