Before we go into Docker, let's talk about virtualization, virtual machines, and containers.
What exactly is Virtualization?
What exactly is a Virtual Machine?
What exactly is a Container?
We can use virtualization to run many servers (Windows, Red Hat, Ubuntu, and so on) on top of a single physical computer, and virtualization occurs at the OS level.
A virtual machine is a "virtual" version of a computer that uses dedicated CPU and memory from the host system or computer.
Advantages
Cost: We are building VMs on top of a single computer, saving infra costs.
Maintenance: Simple because we just have physical machines.
Isolation: Each VM is autonomous and separate from the others.
Disadvantages:
- Significant weight.
- CPU and RAM utilisation are really high.
Containers
Which contains the application-level code that bundles together all of the dependencies needed to run your application.
Application Code:
- Jar, war, ear, etc.
Dependencies:
- Java, Tomcat, Angular, etc.
Advantages:
- Containers are lightweight.
- Resource consumption is very low.
- Deployment is very fast and secure.
What exactly is Docker?
Docker is a containerization technology that uses containers to bundle your app and all of its dependencies or
Docker is a containerization platform that packages your app and all its dependencies together in the form of containers.
Docker is an open platform that allows developers and system administrators to create, deploy, and execute distributed applications.
Docker comes in two flavours.
- Enterprise Edition (EE)
- Community Edition (CE)
Docker Enterprise Edition (EE) is intended for enterprise development and IT teams responsible for building, shipping, and running mission-critical applications in production at scale.
Docker Community Edition (CE) is perfect for developers and small teams who want to experiment with container-based programmes and get started with Docker..
Installing Docker:
- Docker Desktop
- Docker for Linux: Ubuntu
- Docker for Mac OS X
Docker Desktop
Docker for Linux: Ubuntu
Before installing Docker, use the following command to see if Docker is already installed on your Ubuntu machine.
$ docker info
Docker installation requires the following prerequisites
- OS requirements: Docker requires a 64-bit version of Ubuntu Server to be installed.
- If you have any docker, docker.io, docker-engine, containerd, or runc installed, uninstall them.
Docker for Mac OS
As previously described, we may install Docker Desktop for Mac OS from the command line using the Homebrew package manager.
- Open your terminal by pressing command+spacebar and then typing terminal.
- Install the Homebrew package manager in your terminal by using the command below.
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”
After installing homebrew, run the following command to install Docker on your Mac OS.
$ brew cask install docker
After a successful installation, use the docker info command from your Mac terminal window to validate the installation.
$docker info
Docker commands
- docker info
- docker --version
- docker pull
- docker run
- docker ps
- docker ps -a
- docker exec
- docker stop
- docker kill
- docker images
- docker rmi