Docker is a containerization technology/tool that allows you to quickly build, test and deploy applications as portable, self-sufficient containers that can virtually run everywhere.
Start by updating your system packages and install the required dependencies:
[devopstechie@localhost ~]$ sudo yum update [devopstechie@localhost ~]$ sudo yum install yum-utils device-mapper-persistent-data lvm2
Install Docker CE on CentOS 7
The recommended approach is to install Docker from the Docker’s repositories.
Docker provides a repository where you can fetch the stable Docker CE version as below
[devopstechie@localhost ~]$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
To install Docker, simply run:
[devopstechie@localhost ~]$ sudo yum install -y docker-ce
Once the Docker package installed, start the Docker daemon and enable it to automatically start at boot time:
[devopstechie@localhost ~]$ sudo systemctl start docker [devopstechie@localhost ~]$ sudo systemctl enable docker
To verify that the Docker service is running
[devopstechie@localhost ~]$ sudo systemctl status docker
Launching a container requires administrator privileges. If you don’t want to run Docker as the root user, you can run it from your account using
"sudo" in front of each Docker command is tedious – to avoid this, add your user to the
[devopstechie@localhost ~]$ usermod -aG docker your_username
Now, start the Docker service without sudo:
[devopstechie@localhost ~]$ systemctl start docker
You can also see here manage / run Docker command without sudo
Verify Docker Installation
To verify Docker is installed successfully and that you can run docker commands without sudo. You can use the handy “hello-world” test. Run the following command:
[devopstechie@localhost ~]$ docker run hello-world
Output return the welcome message:
Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal.
Congratulations! Part 1 Completed, you have now installed Docker CE on CentOS 7. We will see more docker concepts in details in next parts.