You can install docker in two ways.
####Install the latest docker community edition using script
-
Execute the following commands.
sudo yum update -y sudo yum install wget -y sudo wget https://download.docker.com/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo sudo yum install -y --setopt=obsoletes=0 docker-ce-17.03.1.ce-1.el7.centos docker-ce-selinux 17.03.1.ce-1.el7.centos
-
Add your Linux user to docker group to execute docker commands without sudo.
sudo usermod -aG docker <user-name>
For example,
sudo usermod -aG docker michael
You should restart your terminal for running docker commands without sudo
-
Start the Docker service, check the status and add docker service to boot.
sudo service docker start sudo service docker status sudo chkconfig docker on
Install Stable Docker Version from Official Repo
-
Add the docker repo.
sudo tee /etc/yum.repos.d/docker.repo <<-EOF [dockerrepo] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/7 enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg EOF
-
Update and install docker engine.
sudo yum update -y sudo yum install docker-engine
-
Start the Docker service.
sudo service docker start
Now you will have a working Docker installation. Post a comment if you face any issues.