Guides
Working with Docker

Install Docker on CentOS

7min
installing docker on centos is fairly straightforward and only takes a few commands so let's go through it step by step 1\ remove docker before we start, we need to remove any docker dependencies if you've never installed docker, don't worry you can skip this step $ sudo yum remove docker \\ docker client \\ docker client latest \\ docker common \\ docker latest \\ docker latest logrotate \\ docker logrotate \\ docker engine 2\ set up the repository we need to install the yum utils package yum utils gives us the yum config manager that we need to 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 3\ install docker with yum utils installed, we can go ahead and install docker $ sudo yum install docker ce docker ce cli containerd io 4\ test its working now everything is installed, we should test if it's working so start docker $ sudo systemctl start docker now, start a container to check that docker is installed correctly $ sudo docker run hello world 5\ add non root users you'll notice that if you want to start docker as a non root user, you'll probably run into this error got permission denied while trying to connect to the docker daemon socket at unix ///var/run/docker sock get http //%2fvar%2frun%2fdocker sock/v1 40/containers/json dial unix /var/run/docker sock connect permission denied don't worry there's an easy fix for that first, let's create the docker group $ sudo groupadd docker then add the non root user to the group $ sudo usermod ag docker $user with all that done, you've got docker set up and ready to use