Monday, 19 March 2018

Docker and Containers on RHEL


Docker is an open source software platform to create, deploy and manage virtualized application 
containers on a common operating system (OS), with an ecosystem of allied tools. Docker Inc., 
the company that originally developed Docker, supports a commercial edition and is the principal
sponsor of the open source tool.

Docker is a tool that packages, provisions and runs containers independent of the OS. Container 
technology is available through the operating system: A container packages the application service 
or function with all of the libraries, configuration files, dependencies and other necessary parts to 
operate. Each container shares the services of one underlying operating system.
Docker was created to work on the Linux platform, but has extended to offer greater support for 
non-Linux operating systems, including Microsoft Windows and Apple OS X. Versions of Docker 
for Amazon Web Services (AWS) and Microsoft Azure are available.


The Docker platform is the only container platform to build, secure and manage the widest array of 
applications from development to production both on premises and in the cloud. Docker Community 
Edition [CE] empowers developers with tools to build applications and Docker Enterprise Edition [EE] 
provides IT with multi-architecture operations at scale. Docker delivers both an engine for innovation 
that modernizes without disruption while reducing total costs by more than 50%.

Install docker on RHEL
#####################

Add docker repo
############################
root@dhcppc5 ~]# yum-config-manager     --add-repo 
https://download.docker.com/linux/centos/docker-ce.repo

Loaded plugins: langpacks, product-id
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo 
to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo

Download container-selinux rpm file
###############################
[root@dhcppc5 Downloads]# wget ftp://ftp.icm.edu.pl/vol/rzm6/linux-centos-vault/
7.3.1611/extras/x86_64/Packages/container-selinux-2.9-4.el7.noarch.rpm

Install container-selinux rpm using rpm -ivh
######################################
[root@dhcppc5 Downloads]# rpm -ivh container-selinux-2.9-4.el7.noarch.rpm warning: 
container-selinux-2.9-4.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, 
key ID f4a80eb5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
  1:container-selinux-2:2.9-4.el7    ################################# [100%]

Install docker
##############################
[root@dhcppc5 Downloads]# yum install docker-ce -y

Start docker service
##########################
[root@dhcppc5 Downloads]# systemctl restart docker

Check the docker service
###############################
[root@dhcppc5 Downloads]# systemctl status docker
● docker.service - Docker Application Container Engine
  Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
  Active: active (running) since Fri 2018-02-23 11:54:24 IST; 10min ago
    Docs: https://docs.docker.com
Main PID: 994 (dockerd)
  Memory: 38.6M
  CGroup: /system.slice/docker.service
          ├─ 994 /usr/bin/dockerd
          └─1001 docker-containerd --config /var/run/docker/containerd/containerd.toml

Check the docker network ip configuration
########################################
[root@dhcppc5 Downloads]# ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
       inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
       ether 02:42:82:f0:76:e1  txqueuelen 0 (Ethernet)
       RX packets 0  bytes 0 (0.0 B)
       RX errors 0  dropped 0 overruns 0  frame 0
       TX packets 0  bytes 0 (0.0 B)
       TX errors 0  dropped 0 overruns 0  carrier 0 collisions 0


Install docker on AWS EC2 RHEL
####################################

[root@ip-172-31-24-115 ~]# yum-config-manager --enable rhel-7-server-extras-rpms
Loaded plugins: amazon-id, rhui-lb
[root@ip-172-31-24-115 ~]# yum-config-manager --enable rhui-REGION-rhel-server-extras
[root@ip-172-31-24-115 ~]# yum -y install docker

[root@ip-172-31-24-115 ~]# systemctl restart docker && systemctl enable docker

Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service

to /usr/lib/systemd/system/docker.service.

No comments:

Post a Comment

Amazon EKS - Kubernetes on AWS

By Komal Devgaonkar Amazon Elastic Container Service for Kubernetes (Amazon EKS), which is highly available and scalable AWS service....