Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
68 views2 pages

Docker Notes - Page1 - 2

This document provides an introduction to Docker, including namespacing and control groups (cgroups). Namespacing isolates resources per process or group of processes, partitioning kernel resources so one set of processes only sees its allocated resources. Cgroups limit the amount of resources like CPU and memory available to each process. The document also discusses Docker commands, images, networking, compose, environment variables, and restart policies. It provides a comparison of Docker containers to virtual machines.

Uploaded by

nathan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views2 pages

Docker Notes - Page1 - 2

This document provides an introduction to Docker, including namespacing and control groups (cgroups). Namespacing isolates resources per process or group of processes, partitioning kernel resources so one set of processes only sees its allocated resources. Cgroups limit the amount of resources like CPU and memory available to each process. The document also discusses Docker commands, images, networking, compose, environment variables, and restart policies. It provides a comparison of Docker containers to virtual machines.

Uploaded by

nathan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Table of Contents

Docker Introduction ...................................................................................................................................1


Namespacing: ........................................................................................................................................1
Types of Namespaces .......................................................................................................................2
Control Group (cgroup).........................................................................................................................2
$docker info command ..............................................................................................................................3
Quick glance at docker image:...................................................................................................................3
Docker Container commands.....................................................................................................................4
Docker image commands.........................................................................................................................10
Creating new image: ................................................................................................................................11
Most useful commands in Dockerfile .................................................................................................13
ARG and ENV Availability............................................................................................................16
Multi-step image .................................................................................................................................16
Shell and Exec Form ...........................................................................................................................17
Docker network:.......................................................................................................................................17
Docker compose: .....................................................................................................................................18
The Dot-Env File (.env) ......................................................................................................................21
Setting ARG Values in docker-compose .............................................................................................21
Different ways to set environment variables ...........................................................................................22
1. Provide values one by one ..........................................................................................................22
2. Pass environment variable values from your host......................................................................22
3. Take values from a file (env_file) ..............................................................................................23
Restart policies (--restart) ........................................................................................................................24

Docker Vs VM
1. Docker image is smaller. Docker size is in megabytes vs VM size is typically in Gigabyte
2. Docker containers starts and run much faster.
3. VM of any OS can run on any OS host
4. Docker uses Host OS kernal vs VM uses its own kernal on top of host OS.
5. Docker uses operating system level virtualization as it uses host sytem to talk to kernal and
hardware.
6. VMs are hardware level virtualization as it brigs its own kernal to talk to the harware.
7. In docker we do process isolation.
Docker Introduction
Namespacing Vs CGroup
Namcepsace- Isolate resources per process or group like programs (different versions of java)
CGROUP - limit amount of resoures per process like CPU, Memory, HDD, and network

Namespacing:
isolating resources per process (or group of processes). Example: what portion of hard disk,
which harddisk or mount path to use. Which users to use. Which hostnames and which network
to use etc. which process to use as well for example if we have two version of java installed but
one application need java 8 and other need Java11 then these can be defined and isolated using
namespace to avoid version conflict.

“Namespaces are a feature of the Linux kernel that partitions kernel resources such that one
set of processes sees one set of resources while another set of processes sees a different set of
resources.”
It means two isolated processes work similar to running in two different systems with no
knowledge about each others
In other words, the key feature of namespaces is that they isolate processes from each other. On
a server where you are running many different services, isolating each service and its associated
processes from other services means that there is a smaller blast radius for changes, as well as a
smaller footprint for security-related concerns.

You might also like