What is containerization and what role does Docker play in it?

What is a container?

Container of a ship.

Benefits of containerization:

  1. Portability : The abstraction in containerization ensures that the container works in the same way anywhere you deploy it. It follows the principle of “Write once, Run Anywhere” (Reminds you anything about your early Java days?)
  2. Faster rate of Delivery : Due to the microservice architecture, code changes can be applied to the isolated segments without affecting the application as a whole.

Containers V/s VMs:

  1. Layer 3: Application Layer
  2. Layer 2: Kernel
  3. Layer 1: Hardware
VM and Containers

Docker:

Docker image

Docker Containers V/s Docker Images:

Main docker commands:

  1. docker pull <image:version> : Pulls the docker image from the repository.
  2. docker start <containerid/containername> : Starts an already stopped container
  3. docker run <image> : Creates a container layer over the specified image, and then starts it
  • -d : detached mode
  • -v : mounts the virtual file system of the container to the file system of the host
  • -name : name the container (Docker names a docker by default)
  • -p <hostPort:ContainerPort> : Binds the port of host to the container
  • -a : Lists all the containers (Even the stopped ones)

Docker Compose:

Yaml file
  1. docker-compose -f <filename> up : Starts the compose file
  2. docker-compose -f <filename> down : Stops the compose file

Docker File:

DockerFile

--

--

--

Currently on ☁️

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Difference Between System Admin And Network Admin

Difference Between System Admin And Network Admin

The great UTF-8 migration

This might be my last chance to work as a software developer

Spring — MVC and the Web Layer Q&A

Best ML Github Repos To Checkout

The Third NTX Airdrop Snapshot Period Is About To Begin

Realm Type-Safe update

S-WALLET USER GUIDE

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Soumojit Ghosh

Soumojit Ghosh

Currently on ☁️

More from Medium

Introduction To Docker: A Beginner’s Guide

How Skaffold saved my (local CI/CD) day

What Is Docker?

Starting stopped docker container