Installing Docker on CentOS 7 in Four Simple Steps

Installing_Docker

Are you new to Docker? Docker is an open-source, container-based software framework for creating and managing Linux containers (LXC) in an easy manner. What are containers? Containers are lightweight, encapsulated and portable application modules.

When talking about benefits, Docker helps the coders and system admin for their application development in a container and further can be scaled up to 1000 of nodes.

In this post we will be discussing upon the basic installation of Docker in CentOS 7.x –

Step 1: Installing Docker

There is a need to update your packages:

yum –y update

Now, it’s time to install Docker by installing the docker-io package.

yum –y install docker docker-registry

Step 2: Starting Docker and Ensuring Docker Starts on Boot

Set the Docker service to start at boot:

systemct1 enable docker.service

Then start the Docker service:

systemct1 start docker.service

You can verify your work by checking the status of Docker:

systemct1 status docker.service

Step 3: Downloading a Docker Container –

Let’s start using Docker. Download the centos Docker image:

docker pull centos

Step 4: Running a Docker Container –

Now, it’s time to setup a basic centos container using a bash shell wherein we have to run only one command, docker run will run a command in a new container, -i attaches stdin and stdout, -t allocates a tty.

docker run –i –t centos /bin/bash

That’s done! This means you are now using a bash shell inside of a centos docker container.

If you want to disconnect or detach from the shell without existing use the escape sequence

Ctrl-p + Ctrl-q

You will find several community containers already available and can be found through research. For example, the command below is for searching for keyword centos –

docker search centos 

 So, you can now install Docker on CentOS 7.x with these simple steps.

This entry was posted in FAQs and tagged , . Bookmark the permalink.