Install docker and learn containers on centos

How to install and configure Docker on centos. Learning download a Docker image, running a Docker container and so forth. Step by step install docker on Centos 6 and Centos 7.

To install docker

Docker is incorporated into Centos 7 extras repositories, due to install simple. For Centos 6, you install epel-release” repositories

To install docker on centos 7

# yum update -y && yum install epel-release -y && yum install docker -y

To install docker on centos 6

# yum update -y && yum install epel-release -y && yum install docker-io -y

The finish installed docker, To check status, start, enable services docker the below commands:

For Centos 7

# systemctl start docker
# systemctl status docker
# systemctl enable docker

For Centos 6

# service docker start
# service docker status
# chkconfig docker on

To Learn basic containers, Docker

To search for a Docker image, for example, centos image

# docker search centos

you are choice image and download it locally, use docker pull command

# docker pull centos

List all the available Docker images on your host

# docker images

To delete images

# docker rmi centos

Creating and rune a container

# docker run --name My_OS centos cat /etc/hosts

Starting, stats and stop a container

# docker start My_OS
# docker stats My_OS
# docker stop My_OS

To Run an Interactive Session into a container

# docker run --name My_OS -it centos bash

To reconnect to the running container you need the container ID or name

# docker attach My_OS

Stopping a running container from the host

# docker kill My_OS


Through this article, you have installed docker on Centos and learning basic commands of docker. I hope this helps you. Thank you for reading the DevopsRoles page!

, ,

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

6 thoughts on “Install docker and learn containers on centos

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.