How To Install Docker on Centos 7 and Red Hat 7

Hello friends, I’m starting some posts referring to a Docker.
During the next months, we will make an update more frequent, all of us who have a suggestion please send an email to: geraldo@techpoli.info.

Introduction:

Docker is a software technology providing containers, promoted by the company Docker, Inc. Docker provides an additional layer of abstraction and automation of operating-system-level virtualization on Windows and Linux. Docker uses the resource isolation features of the Linux kernel such as cgroups and kernel namespaces, and a union-capable file system such as OverlayFS and others to allow independent “containers” to run within a single Linux instance, avoiding the overhead of starting and maintaining virtual machines.

The Linux kernel’s support for namespaces mostly isolates an application’s view of the operating environment, including process trees, network, user IDs and mounted file systems, while the kernel’s cgroups provide resource limiting, including the CPU, memory, block I/O, and network. Since version 0.9, Docker includes the libcontainer library as its own way to directly use virtualization facilities provided by the Linux kernel, in addition to using abstracted virtualization interfaces via libvirt, LXC (Linux Containers) and systemd-nspawn.

Step 1: Installation of Docker

As a matter of best practice we’ll update our packages:

yum -y update

Now run this command. It will add the official Docker repository, download the latest version of Docker and install it:

curl -fsSL https://get.docker.com/ | sh

Step 2: Start the docker and configure to start with the operating system.

Set the Docker service to start at boot:

systemctl enable docker

Then start the Docker service:

systemctl start docker

And verify your work by checking the status of Docker:

systemctl status docker

Step 3: Download Container

Download the centos Docker image:

Note you can choose any system like Ubuntu or Debian.

docker pull centos

Step 4: Run Container

As an example, let’s run a container using the latest image of CentOS. The combination of the -i and -t switches gives you interactive shell access into the container:

docker run -i -t centos /bin/bash

You are now using a docking dock inside a docker centos.

To disconnect or detach from the shell without exiting, use a string of Ctrl + Ctrl-p + Ctrl-q.

There are many community containers already available that can be found through a survey. On the command below, I look for a Ubuntu keyword:

docker search ubuntu:17.04

Friends, that’s all.
We will continue with more advanced articles on docker.

You may also like

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *