Sunday 7 October 2018

Docker Installation


Prerequisites:

·       It only works on a 64-bit Linux installation.
·       It requires Linux kernel version 3.10 or higher.

Note- I’ll be working from a Centos-7.2 server, and I’ll be logged in as root.

Step-1 Check the kernel version and the OS architecture.


[root@docker-server ~]# uname -a

Linux docker-server 3.10.0-327.el7.x86_64 #1 SMP Thu Oct 07 22:10:57 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Prerequisites:

·       It only works on a 64-bit Linux installation.
·       It requires Linux kernel version 3.10 or higher.

Note- I’ll be working from a Centos-7.2 server, and I’ll be logged in as root.

Step-1 Check the kernel version and the OS architecture.


[root@docker-server ~]# uname -a

Linux docker-server 3.10.0-327.el7.x86_64 #1 SMP Thu Sun Oct  7 15:57:01 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

You can see that I`m using the kernel version is 3.10.0 with a 64Bit Kernel (x86_64).

[root@docker-server ~]# cat /etc/centos-release
CentOS Linux release 7.2.1511 (Core)

The command shows that the Centos version is 7.2.


Step-2 It is recommended to update Ubuntu before you install new software.

[root@docker-server ~]# yum update

Step-3 Now Install Docker

Note-

Docker is available in two editions:

·       Community Edition (CE)

Docker Community Edition (CE) is ideal for developers and small teams looking to get started with Docker and experimenting with container-based apps. that’s available for free of cost. Docker CE has two update channels, stable and edge:

Stable gives you reliable updates every quarter
Edge gives you new features every month

·       Enterprise Edition (EE).

Docker Enterprise Edition (EE) is designed for enterprise development and IT teams who build, ship, and run business critical applications in production at scale. that’s not available for free of cost. For more information about Docker EE, including purchasing options.





Docker package is included in the default CentOS repository. So to install docker , simply run below yum command :

[root@docker-server ~]# yum install docker -y

If you want to install Docker Community Edition (CE), Use the below mention step

1- Install the Docker CE dependencies..

[root@docker-server ~]# yum install yum-lvm2 utils device-mapper-persistent-data                                                                                                                                    -y

2- Installing Docker CE (Install Docker CE Repositery and install docker)

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

[root@docker-server ~]#    yum install     docker-ce    -y

3- Verify The Docker Verion

[root@docker-server ~]# docker --version
Docker version 17.12.0-ce, build c97c6d6

Step-4 Start the Docker services

[root@docker-server ~]# systemctl start docker
[root@docker-server ~]# systemctl enable docker

Step-5 Check the status of the Docker

[root@docker-server ~]# systemctl status docker

  docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2018-10-07 18:03:49 IST; 1min 36s ago

Main PID: 28494 (dockerd)
CGroup: /system.slice/docker.service

├─28494 /usr/bin/dockerd

└─28499 docker-containerd --config /var/run/docker/containerd/containerd.toml Oct 07 18:03:49 docker-server systemd[1]: Started Docker Application Container Engine.
Oct 07 18:03:49 docker-server dockerd[28494]: time="2018-10-07T18:03:49.912071806+05:30"
level=info msg="API listen on /var/run/docker.sock"
Hint: Some lines were ellipsized, use -l to show in full.



Step-5 Test Docker

[root@docker-server ~]# docker run hello-world

Note- The above command docker run hello-world has three parts.

·       docker- It is docker engine and used to run docker program. It tells to the operating system that you are running docker program.

·       run- This subcommand is used to create and run a docker container.

·       hello-world- It is a name of an image. You need to specify the name of an image which is to load into the container.


When successfully run above command then, this will return the welcome message:-


Now docker is installed in your system. You can start making a container by downloading a Docker Image from the Docker Registry.

No comments:

Post a Comment