Install Docker on Centos 7
Install Docker on Centos 7/6
Docker is a containerization tool that separates your application from your host system using containers and you can run your applications. containers are similar to virtual machines. in the following steps i will show you how to install docker on centos 7.
update all packages
sudo yum update -y
by using above command you can update all packages in tour system. it will update every currently installed package in your centos.
install the required packages to install docker on centos 7/6
sudo yum install lvm2 device-mapper device-mapper-event-libs device-mapper-event device-mapper-libs device-mapper-persistent-data -y
add the Docker yum repository
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
it will add docker-ce repo file(docker-ce.repo) in /etc/yum.repos.d/ directory
docker repo is enabled in your system now you can install docker on centos 7
Install Docker on Centos 7/6
Install the latest version of Docker CE on centos 7/6 using the following command
sudo yum install docker-ce -y
Start the Docker daemon and enable
sudo systemctl start docker sudo systemctl enable docker
Using above commands docker service will start. And it will start automatically at the boot time.
verify that the Docker service is running
you can verify is docker service running or not by using status command
sudo systemctl status docker
[root@ip-10-0-0-22 ~]# sudo systemctl status docker ? docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled) Active: active (running) since Tue 2019-02-12 07:19:23 UTC; 35s ago Docs: https://docs.docker.com Main PID: 17958 (dockerd) CGroup: /system.slice/docker.service +-17958 /usr/bin/dockerd -H fd:// +-17975 containerd --config /var/run/docker/containerd/containerd.... Feb 12 07:19:23 ip-10-0-0-22.ec2.internal dockerd[17958]: time="2019-02-12T07... Feb 12 07:19:23 ip-10-0-0-22.ec2.internal dockerd[17958]: time="2019-02-12T07... Feb 12 07:19:23 ip-10-0-0-22.ec2.internal dockerd[17958]: time="2019-02-12T07... Feb 12 07:19:23 ip-10-0-0-22.ec2.internal dockerd[17958]: time="2019-02-12T07... Feb 12 07:19:23 ip-10-0-0-22.ec2.internal dockerd[17958]: time="2019-02-12T07... Feb 12 07:19:23 ip-10-0-0-22.ec2.internal dockerd[17958]: time="2019-02-12T07... Feb 12 07:19:23 ip-10-0-0-22.ec2.internal dockerd[17958]: time="2019-02-12T07... Feb 12 07:19:23 ip-10-0-0-22.ec2.internal dockerd[17958]: time="2019-02-12T07... Feb 12 07:19:23 ip-10-0-0-22.ec2.internal dockerd[17958]: time="2019-02-12T07... Feb 12 07:19:23 ip-10-0-0-22.ec2.internal systemd[1]: Started Docker Applicat... Hint: Some lines were ellipsized, use -l to show in full.
docker service is running. now we have successfully installed docker in centos 7
Run Docker commands without sudo
if you want to run docker commands you must have administrative privileges. so you can run docker commands with root user or sudo user. but using sudo every time is a tedious.
so to avoid this problem we can add user to docker group
usermod -aG docker your_username
now you can run docker commands without sudo
- How To Install and Use Docker on CentOS 7
- install docker on centos 7
- centos docker install
- docker install centos