Skip to main content

Command Palette

Search for a command to run...

How to install Docker on CentOS 7 machine

Published
1 min read
How to install Docker on CentOS 7 machine
M

Hey, I'm a postgraduate in Cyber Security with practical experience in Software Engineering and DevOps Operations. The top player on TryHackMe platform, multilingual speaker (Kazakh, Russian, English, Spanish, and Turkish), curios person, bookworm, geek, sports lover, and just a good guy to speak with!

Overview:

  1. CentOS machine based on 7.9.2009(Core) release
  2. To check the version of the CentOS machine use:
    cat /etc/centos-release
    
  3. Docker community edition is installed

Docker installation and configuration:

  1. Remove the old version of the Docker from the machine:
    sudo yum remove -y docker \
    docker-client \
    docker-client-latest \
    docker-common \
    docker-latest \
    docker-latest-logrotate \
    docker-logrotate \
    docker-engine
    
  2. Install prerequisite utility software:
    sudo yum install -y yum-utils \
    device-mapper-persistent-data \
    lvm2
    
  3. Install the Docker repository:
    sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
    
  4. Install the Docker:
    sudo yum install -y docker-ce
    
  5. Start Docker daemon and enable autostartup:
    sudo systemctl start docker && sudo systemctl enable docker
    
  6. Add your current user to the docker group:
    sudo usermod -aG docker [username]
    
  7. For changes to take effect logout from your instance and then log back in
  8. Check the installed Docker version:
    docker version
    

Reference:

  1. yum-utils is a collection of tools and programs for managing yum repositories, installing debug packages, source packages, extended information from repositories and administration.
  2. device-mapper-persistent-data
  3. LVM2 refers to the userspace toolset that provide logical volume management facilities on linux. It is reasonably backwards-compatible with the original LVM toolset.

More from this blog

M

Maxat Akbanov's blog

259 posts

Postgraduate in Cyber Security with experience in Software Engineering and DevOps Operations.