ABCD of Docker
Welcome to ABCD of Docker
Any idea on DevOps ? No. OK let me introduce DevOps first then we will move ahead.
In my Definition, DevOps is nothing but, its a set of tools which will link Development with operations. Operations like Support, monitoring, deployment, automation testing. The process of automating the steps required to Go-live and production deployment.
List of tools which build the DevOps Eco-System (I am focusing on open Source only)
- Version Control tools (Git, SVN, BitBucket)
- Build and Deploy (Jenkins, Apache Maven, Gradle, Grunt, Gulp)
- Testing tools (JUnit, Selenium, Protactor)
- Deploy Management ( Docker, Puppet)
- Monitor (Nagios, zabbix, Ganglia)
Most common tools
- Tomcat, Apache
So lets comeback to Docker:
Docker is a container which allow to package multiple things and make a container. One container may contains Application server, Application, Running Environment and shared OS library. I have just mentioned “Shared OS Library”. So that’s new thing.
So before moving to docker, i want to go back 1 step. Have you installed VMWare, VirtualBox. In-case you don’t have any idea on those, i would suggest, you should not move ahead with this article, because first you need to understand how traditional Virtualisation works, then only you can move to docker.
How VMWare Player or VirtualBox Works:
So lets discuss a bit about VirtualBox and how it works
- Basically its called VM (Virtual Machine, its a Virtual thing/machine installed on real OS using tool called VirtualBox)
- Host OS (Your Laptop/Desktop OS, where you have installed the VirtualBox) – Windows 7, 8
- VirtualBox (Tool which enables virtualisation )
- Guest OS ( Different OS that you are installing to VirtualBox ) – Ubuntu, Android OS, CentOS
- Application (Java/PHP Applications that are deployed and configured inside VirtualBox Guest OS)
What are the drawbacks of VirtualBox (VMs)
- You need to install multiple Guest OS (Ubuntu, CentOS) on VirtualBox – every-time you need a new VM (Ubuntu, CentOS), you need to install entire thing and it takes lots of space.
- During VM creation, we need to allocate RAM, CPU and Hard Disk Space. The biggest disadvantage is, in-case you are allocating 4GB of Ram, even-if its not required VM will take entire 4GB of RAM, where it supposed to take only required RAM only. Same issue goes for CPU and Hard disk Space.
- Its really difficult to share OS Kernel level configuration between multiple VM. I mean 2 different VMs can not talk directly.
- VMs are slow Startup/Boot time.
Lets consider below Example. Left side of the example contains Architecture of VM and Right side of the example contains Architecture of Docker.
Difference between VM and Docker
VM – Virtual Machine
How Docker Works:
Step-1 (Download and install the Docker on your OS – HOST OS)
- Download and install Docker toolbox from Docker site.
- In-case you are using Windows 10 and above or Mac then You can install Docker Engine. Docker Engine is not available for Windows 8.1 and lower.
- Windows 10 and Above: The Hyper-V package must be enabled for Docker for Windows to work. The Docker for Windows installer will enable it for you, if needed. (This requires a reboot).
- Windows 8.1 and Below: You can install Docker Toolbox, which uses Oracle Virtual Box instead of Hyper-V. Virtualization must be enabled. Typically, virtualization is enabled by default. In-case its not enabled, go-to system BIOS to enable it. Most Recent Intel and AMD Processor do have this feature.
Step-2 (Signup for Docker Hub – Website)
- Signup for a new Account in Docker Hub. Docker Hub contains all the list of pre-build docker container.
- You can also create your container and submit your Container to Docker hub so that other people can use it.
- Remember with free account you can submit only one container to docker hub.
- You can have your own docker hub.
Step-3 (Run a Hello World)
- After instalingl Docker or Docker toolbox you are ready to install a docker container
- In-case you have installed Docker toolbox, then you have to click on “Docker Quickstart Terminal” to configure the docker on your system.
- Run the following command
- “docker run hello-world”
Common Commands of Docker.
- docker run docker-container-name
- docker run docker-container-id
- docker ps
- docker ps -a
Install, run and exit Ubuntu in Docker
- docker run ubuntu
- docker run -it ubuntu bash
What’s Next. Following 4 are the most top level thing used in production, so far what ever we have learned all are concept to kick start docker. But you need to learn below mentioned concept to become a actual docker.
- Docker Link
- Docker Compose
- Docker multi container Application
- Docker multi host application