Installing Docker CE in CentOS/RHEL 7 is a trivial process but it is not true in all cases. Specially, when we deal with open source products, maintaining and patching might be an issue for doing it in timely manner. Community forums and other sources are our life savers to find workarounds for any encountering roadblocks.

1. Remove old version

yum remove docker \
           docker-client \
           docker-client-latest \
           docker-common \
           docker-latest \
           docker-latest-logrotate \
           docker-logrotate \
           docker-engine

2. Set up Docker repository

  • Install package manager.

    yum install -y yum-utils
    
  • Add the Docker repository to the repository database.

    yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
    

    If an error has been received, it has to be applied a workaround. As per version 7.9 on Oct 6, 2020, the repository path is broken and the path needs to be adjusted manually with the command.

    yum-config-manager --setopt="docker-ce-stable.baseurl=https://download.docker.com/linux/centos/7/x86_64/stable" --save
    

3. Install the latest version of Docker CE

yum install docker-ce docker-ce-cli containerd.io

4. Enable and run docker daemon

systemctl enable docker
systemctl start docker

5. Validate installation

  • Docker service status

    systemctl status docker
    

    Output

    ● docker.service - Docker Application Container Engine
       Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
       Active: active (running) since Tue 2020-10-06 10:08:03 EDT; 1 weeks 5 days ago
    
  • Run the sample image

    docker run -it centos echo Hello-World
    

    Output

    Hello-World
    

Resources


Comments

comments powered by Disqus