Saturday, 24 September 2016

Installing Docker (OperatingSystem : CentOs 7)

There are two method to Install Docker in CentOS 7

[Method1]: Install with yum

$ cd /etc/yum.repos.d yum.repos.d]$ ls -la CentOs-Base.repo,CentOs-CR.repo,CentOs-Debuginfo.repo, CentOs-fasttrack.repo,CentOs-Media.repo,CentOs-Soureces.repo CentOs-Vault.repo,epel.repo, epel-testing.repo $ sudo vim docker.repo [dockerrepo] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/7/ enable=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg $sudo yum update $sudo yum install docker-engine $sudo systemctl enable docker //To enable our docker service $sudo systemctl start docker //start the docker $sudo systemctl status docker //check the status of the docker By default the docker create a file in "/var/run" directory that own by the docker group called docker.sock, if you are not the member of that group or you are not root by default you dont have access to the docker daemon. $ sudo usermod -aG docker your_username //add your user to docker group $ docker images $ docker run hello-world // pull the image and create a Container

[Method2]: Install with script

$ sudo yum update //make sure your existing yum packages are up-to-date $ curl -fsSL https://get.docker.com/| sh //run the docker installation script This Script adds the docker.repo repository and installs Docker. $ sudo service docker start

Uninstall Docker:

$ yum list installed |grep docker //list the package you have installed $ sudo yum -y remove docker-engine.x86_64 //remove the package This command does not remove images, containers, volumes or user-created configuration files on host. $ rm -rf /var/lib/docker //delete all your images,containers,volumes

No comments:

Post a Comment