Why Containers ?

  • For packaging and running applications across diverse environments on-prem or cloud
  • lightweight, isolated environment — easy to develop, deploy and manage.
  • quick start/stop
  • useful for utilizing your infrastructure

Virtual Machine with Containers (Process Isolation)

  • Process Isolation — This is the “traditional isolation” for containers. Containers instances run with isolation provided through namespace, resource control and process isolation technologies. Containers share same kernel with host as well as with each other (same as how linux containers run).
docker run -it --isolation=process mcr.microsoft.com/windows/servercore:ltsc2016 cmd

Hyper-V Isolation for Containers

  • Hyper-V Isolation — This isolation mode offers enhanced security and broader compatibility…


Kubernetes Basics

minikube cli screenshot
minikube cli screenshot

Check if minikube is installed

minikube version

Start the cluster

minikube start

Check if kubectl is installed

kubectl version

Check cluster details

kubectl cluster-info

View nodes in the cluster

kubectl get nodes

Deploy an app

kubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1

List your deployment

kubectl get deployments

Check existing pods

kubectl get podskubectl get pods -o wide

Describe pods

kubectl describe pods

Check logs of a container running in pod

kubectl logs $POD_NAME

Execute command directly inside container running in a pod

kubectl exec $POD_NAME env

Start a bash session in a pod container

kubectl exec -ti $POD_NAME bash

List current services from your cluster

kubectl get services

Create a new service and expose it to external traffic with NodePort as paramter

kubectl expose deployment/kubernetes-bootcamp --type="NodePort" --port 8080

Describe a service

kubectl describe services/kubernetes-bootcamp

Test your app on the externally exposed port

curl $(minikube ip):$NODE_PORT

Query list of pods using label

kubectl get pods -l run=kubernetes-bootcamp

Query list of services using label

kubectl get services -l run=kubernetes-bootcamp

Apply a new label to the object

kubectl label pod $POD_NAME app=v1

Deleting a service

kubectl delete service -l run=kubernetes-bootcamp

Scale up the service

kubectl scale deployments/kubernetes-bootcamp --replicas=4

Scale down the service

kubectl scale deployments/kubernetes-bootcamp --replicas=2

Rolling update, Update the image of your application


Fix HNS Related errors

# MAKE SURE HOST IS NOT IN SWARM MODE
docker swarm leave --force
# removes all container networks on the system.
docker network prune -f
# removes all containers on the system.
docker container prune -f
# stop docker service
net stop docker
# clean…

Basic docker commands for beginners

  1. Check Docker Version
docker version
docker info

Docker commands — Images

docker search <<imagename>> | head -20docker search ubuntu | head -20
# will search ubuntu images in the dockerhub and limit the search result to only 20
docker search ubuntu | select -first 10
docker…


Ashish Singh Baghel

Digital Enthusiast

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