Tech Kaizen

passion + usefulness = success .. change is the only constant in life

Search this Blog:

Docker Containers Overview

Containerization is a way of sharing parts of a single operating system among multiple isolated applications, as opposed to virtualization which will support multiple apps with their own OS on top of a single hypervisor. This means that where it can take minutes to spin up a virtual machine, it can take seconds to start a container because you aren't having to fire up the OS as well. This is beneficial for massive distributed applications with lots of discrete parts that need to be summoned, run, and then killed in short order.

Application containerization is an OS-level virtualization method used to deploy and run distributed applications without launching an entire virtual machine (VM) for each app. Multiple isolated applications or services run on a single host and access the same OS kernel. Containers work on bare-metal systems, cloud instances and virtual machines, across Linux and select Windows and Mac OSes.

Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. Docker provides the ability to package and run an application in a loosely isolated environment called a container. The isolation and security allow you to run many containers simultaneously on a given host.

A Docker container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings. Container images become containers at runtime and in the case of Docker containers - images become containers when they run on Docker Engine. Available for both Linux and Windows-based applications, containerized software will always run the same, regardless of the infrastructure. Containers isolate software from its environment and ensure that it works uniformly despite differences for instance between development and staging.


By default Docker containers can make connections to the outside world, but the outside world cannot connect to containers. Each outgoing connection will appear to originate from one of the host machine’s own IP addresses thanks to an iptables masquerading rule on the host machine that the Docker server creates when it starts:

$ sudo iptables -t nat -L -n
...
Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
MASQUERADE  all  --  172.17.0.0/16       0.0.0.0/0
...


Docker is written in Go programming language and takes advantage of several features of the Linux kernel to deliver its functionality. Docker uses a technology called namespaces to provide the isolated workspace called the container. When you run a container, Docker creates a set of namespaces for that container. Docker Engine on Linux also relies on another technology called control groups (cgroups). A cgroup limits an application to a specific set of resources.

Docker Containers have become extremely popular in modern software development. A delivery vehicle for applications, containers are self-contained execution environments with their own isolated CPU, memory, block I/O, and network resources, that share the kernel of the host operating system.

Docker containers that run on Docker Engine:


    1. Standard: Docker created the industry standard for containers, so they could be portable anywhere


    2. Lightweight: Containers share the machine’s OS system kernel and therefore do not require an OS per application, driving higher server efficiencies and reducing server and licensing costs


    3. Secure: Applications are safer in containers and Docker provides the strongest default isolation capabilities in the industry



Microsoft WSL(Windows Subsystem for Linux) vs Windows Docker Container:

WSL is primarily designed to bring Linux command-line environment on Windows. WSL runs native Linux ELF-64 binaries directly on Windows, and enables you to run your favorite Linux tools atop your Windows "host" OS, sharing the same underlying file-system, networking, process list, etc. as the host OS. 
Docker, on the other hand, provides a way to quickly & easily create a container that essentially wraps a shared (host) kernel & OS, with additional layers of extra functionality (e.g. adding Java, Ruby, MySQL, etc.). It's also easy to pcakge, deploy, and/or share your Docker containers with others if you wish.

WSL is built as a productivity tool for developers & IT Pro's who need a local, immediate, genuine Linux-compatible environment that integrates with Windows, and allows Linux tools to run alongside and/or interact with Windows files/apps. Docker is built to enable isolated containers to be quickly, reliably, and repeatedly constructed, deployed and/or shared, but do not integrate deeply with your host machine's OS. 
WSL is a local dev productivity feature, but is not suitable as a host for production workloads - that's where Docker and/or VM's shine.


Linux(Ubuntu) Bash Shell Scripts for Docker commands:


docker_install() {
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
    sudo apt-get update
    apt-cache policy docker-ce
    sudo apt-get install -y docker-ce
}

docker_setup() {

    sudo usermod -aG docker ${USER}
    su - ${USER}
    id -nG
    docker_status
}

docker_info() {

sudo systemctl status docker
echo -e "\n\n docker info .. \n\n"
docker --version
docker info
echo -e "\n\n docker containers RUNNING \n\n"
docker container ls --all
}

docker_proxy_setup() {

mkdir /etc/systemd/system/docker.service.d
echo [Service] >> http-proxy.conf
echo Environment="HTTP_PROXY=$YOUR_PROXY/" >> http-proxy.conf
sudo systemctl daemon-reload
sudo systemctl show --property Environment docker
sudo systemctl restart docker
docker run hello-world
}

docker_containers_show() {

echo -e "\n\nDocker Containers list.. \n\n"
docker container ps -a
}

docker_containers_remove() {
echo -e "\n\nDocker Containers list .. \n\n"
docker container ps -a

echo -e "\n\nStopping Docker Containers .. \n\n"
docker stop $(docker ps -qa)
docker rm $(docker ps -qa)

echo -e "\n\nDocker Containers  list  .. \n\n"
docker container ps -a
}

# $1 = docker container id
docker_container_ip_address() {
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $1
}

# $1 = docker container name ; $2 = docker image name
docker_container_create() {
docker run -d --name $1 --rm -i -t $2 bash
    # example: docker run -d --name ubuntu-1 --rm -i -t ubuntu bash
}

# $1 = source file name $2 = docker container name
docker_container_copy_files() {
docker cp $1 $2:/
    # example: docker cp test_1 ubuntu-1:/
}

# $1 = docker container name ; $2 = process_to_execute
docker_container_exec() {
docker exec -it $1 $2 
    # example: docker exec -it ubuntu-1 ./test_process
}

ref:


Docker - https://www.docker.com/, https://en.wikipedia.org/wiki/Docker_(software)

Docker Documentation - https://docs.docker.com/

Docker FAQ - https://docs.docker.com/engine/faq/


Docker Commands Cheat Sheets -       

    1. https://www.docker.com/sites/default/files/Docker_CheatSheet_08.09.2016_0.pdf
    
    2. https://github.com/wsargent/docker-cheat-sheet
    
    3. https://hackernoon.com/docker-commands-the-ultimate-cheat-sheet-994ac78e2888
    
    4. https://devhints.io/docker
    
    5. https://www.linode.com/docs/applications/containers/docker-commands-quick-reference-cheat-sheet/

Docker Overview -

    1. https://docs.docker.com/engine/docker-overview/


    2. https://www.docker.com/resources/what-container


    3. https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux_atomic_host/7/html/overview_of_containers_in_red_hat_systems/introduction_to_linux_containers


    4. https://ericchiang.github.io/post/containers-from-scratch/


Docker Security - https://docs.docker.com/engine/security/security/


Rancher OS(fast, ultra-lightweight container OS) - https://rancher.com/rancher-os/


Docker internals -

    1. https://medium.com/@nagarwal/understanding-the-docker-internals-7ccb052ce9fe


    2. https://itnext.io/chroot-cgroups-and-namespaces-an-overview-37124d995e3d

 
How is it possible to run a CentOS container on Ubuntu OS - https://forums.docker.com/t/how-is-this-possible-centos-container-on-ubuntu-newbie-question/21558/5

Misc =>

https://www.ca.com/en/blog-developers/docker-containers-os-base-image.html

https://jvns.ca/blog/2016/10/10/what-even-is-a-container/

https://www.slideshare.net/jpetazzo/anatomy-of-a-container-namespaces-cgroups-some-filesystem-magic-linuxcon

https://stackoverflow.com/questions/29911415/docker-container-isolation-does-it-care-about-underlying-linux-os?lq=1

https://devops.stackexchange.com/questions/447/why-it-is-recommended-to-run-only-one-process-in-a-container

Labels: CLOUD COMPUTING
Newer Post Older Post Home

The Verge - YOUTUBE

Loading...

Google - YOUTUBE

Loading...

Microsoft - YOUTUBE

Loading...

MIT OpenCourseWare - YOUTUBE

Loading...

FREE CODE CAMP - YOUTUBE

Loading...

NEET CODE - YOUTUBE

Loading...

GAURAV SEN INTERVIEWS - YOUTUBE

Loading...

Y Combinator Discussions

Loading...

SUCCESS IN TECH INTERVIEWS - YOUTUBE

Loading...

IGotAnOffer: Engineering YOUTUBE

Loading...

Tanay Pratap YOUTUBE

Loading...

Ashish Pratap Singh YOUTUBE

Loading...

Questpond YOUTUBE

Loading...

Kantan Coding YOUTUBE

Loading...

CYBER SECURITY - YOUTUBE

Loading...

CYBER SECURITY FUNDAMENTALS PROF MESSER - YOUTUBE

Loading...

DEEPLEARNING AI - YOUTUBE

Loading...

STANFORD UNIVERSITY - YOUTUBE

Loading...

NPTEL IISC BANGALORE - YOUTUBE

Loading...

NPTEL IIT MADRAS - YOUTUBE

Loading...

NPTEL HYDERABAD - YOUTUBE

Loading...

MIT News

Loading...

MIT News - Artificial intelligence

Loading...

The Berkeley Artificial Intelligence Research Blog

Loading...

Microsoft Research

Loading...

MachineLearningMastery.com

Loading...

Harward Business Review(HBR)

Loading...

Wharton Magazine

Loading...
My photo
Krishna Kishore Koney
View my complete profile
" It is not the strongest of the species that survives nor the most intelligent that survives, It is the one that is the most adaptable to change "

View krishna kishore koney's profile on LinkedIn

Monthly Blog Archives

  • ►  2025 (2)
    • ►  May (1)
    • ►  April (1)
  • ►  2024 (18)
    • ►  December (1)
    • ►  October (2)
    • ►  September (5)
    • ►  August (10)
  • ►  2022 (2)
    • ►  December (2)
  • ►  2021 (2)
    • ►  April (2)
  • ►  2020 (17)
    • ►  November (1)
    • ►  September (7)
    • ►  August (1)
    • ►  June (8)
  • ▼  2019 (18)
    • ►  December (1)
    • ►  November (2)
    • ►  September (3)
    • ►  May (8)
    • ►  February (1)
    • ▼  January (3)
      • Inter Virtual Machine Communication
      • Hypervisor: KVM, XEN
      • Docker Containers Overview
  • ►  2018 (3)
    • ►  November (1)
    • ►  October (1)
    • ►  January (1)
  • ►  2017 (2)
    • ►  November (1)
    • ►  March (1)
  • ►  2016 (5)
    • ►  December (1)
    • ►  April (3)
    • ►  February (1)
  • ►  2015 (15)
    • ►  December (1)
    • ►  October (1)
    • ►  August (2)
    • ►  July (4)
    • ►  June (2)
    • ►  May (3)
    • ►  January (2)
  • ►  2014 (13)
    • ►  December (1)
    • ►  November (2)
    • ►  October (4)
    • ►  August (5)
    • ►  January (1)
  • ►  2013 (5)
    • ►  September (2)
    • ►  May (1)
    • ►  February (1)
    • ►  January (1)
  • ►  2012 (19)
    • ►  November (1)
    • ►  October (2)
    • ►  September (1)
    • ►  July (1)
    • ►  June (6)
    • ►  May (1)
    • ►  April (2)
    • ►  February (3)
    • ►  January (2)
  • ►  2011 (20)
    • ►  December (5)
    • ►  August (2)
    • ►  June (6)
    • ►  May (4)
    • ►  April (2)
    • ►  January (1)
  • ►  2010 (41)
    • ►  December (2)
    • ►  November (1)
    • ►  September (5)
    • ►  August (2)
    • ►  July (1)
    • ►  June (1)
    • ►  May (8)
    • ►  April (2)
    • ►  March (3)
    • ►  February (5)
    • ►  January (11)
  • ►  2009 (113)
    • ►  December (2)
    • ►  November (5)
    • ►  October (11)
    • ►  September (1)
    • ►  August (14)
    • ►  July (5)
    • ►  June (10)
    • ►  May (4)
    • ►  April (7)
    • ►  March (11)
    • ►  February (15)
    • ►  January (28)
  • ►  2008 (61)
    • ►  December (7)
    • ►  September (6)
    • ►  August (1)
    • ►  July (17)
    • ►  June (6)
    • ►  May (24)
  • ►  2006 (7)
    • ►  October (7)

Blog Archives Categories

  • .NET DEVELOPMENT (38)
  • 5G (5)
  • AI (Artificial Intelligence) (9)
  • AI/ML (4)
  • ANDROID DEVELOPMENT (7)
  • BIG DATA ANALYTICS (6)
  • C PROGRAMMING (7)
  • C++ PROGRAMMING (24)
  • CAREER MANAGEMENT (6)
  • CHROME DEVELOPMENT (2)
  • CLOUD COMPUTING (45)
  • CODE REVIEWS (3)
  • CYBERSECURITY (12)
  • DATA SCIENCE (4)
  • DATABASE (14)
  • DESIGN PATTERNS (9)
  • DEVICE DRIVERS (5)
  • DOMAIN KNOWLEDGE (14)
  • EDGE COMPUTING (4)
  • EMBEDDED SYSTEMS (9)
  • ENTERPRISE ARCHITECTURE (10)
  • IMAGE PROCESSING (3)
  • INTERNET OF THINGS (2)
  • J2EE PROGRAMMING (10)
  • KERNEL DEVELOPMENT (6)
  • KUBERNETES (19)
  • LATEST TECHNOLOGY (18)
  • LINUX (9)
  • MAC OPERATING SYSTEM (2)
  • MOBILE APPLICATION DEVELOPMENT (14)
  • PORTING (4)
  • PYTHON PROGRAMMING (6)
  • RESEARCH AND DEVELOPMENT (1)
  • SCRIPTING LANGUAGES (8)
  • SERVICE ORIENTED ARCHITECTURE (SOA) (10)
  • SOFTWARE DESIGN (13)
  • SOFTWARE QUALITY (5)
  • SOFTWARE SECURITY (23)
  • SYSTEM and NETWORK ADMINISTRATION (3)
  • SYSTEM PROGRAMMING (4)
  • TECHNICAL MISCELLANEOUS (31)
  • TECHNOLOGY INTEGRATION (5)
  • TEST AUTOMATION (5)
  • UNIX OPERATING SYSTEM (4)
  • VC++ PROGRAMMING (44)
  • VIRTUALIZATION (8)
  • WEB PROGRAMMING (8)
  • WINDOWS OPERATING SYSTEM (13)
  • WIRELESS DEVELOPMENT (5)
  • XML (3)

Popular Posts

  • Observer Pattern - Push vs Pull Model
  • Cross Platform Audio(sound) Libraries ..
  • Microservices Architecture ..
  • SWIFT, IFX, OFX, FIX

My Other Blogs

  • Career Management: Invest in Yourself
  • Color your Career
  • Attitude is everything(in Telugu language)
WINNING vs LOSING

Hanging on, persevering, WINNING
Letting go, giving up easily, LOSING

Accepting responsibility for your actions, WINNING
Always having an excuse for your actions, LOSING

Taking the initiative, WINNING
Waiting to be told what to do, LOSING

Knowing what you want and setting goals to achieve it, WINNING
Wishing for things, but taking no action, LOSING

Seeing the big picture, and setting your goals accordingly, WINNING
Seeing only where you are today, LOSING

Being determined, unwilling to give up WINNING
Gives up easily, LOSING

Having focus, staying on track, WINNING
Allowing minor distractions to side track them, LOSING

Having a positive attitude, WINNING
having a "poor me" attitude, LOSING

Adopt a WINNING attitude!

Total Pageviews

who am i

My photo
Krishna Kishore Koney

Blogging is about ideas, self-discovery, and growth. This is a small effort to grow outside my comfort zone.

Most important , A Special Thanks to my parents(Sri Ramachandra Rao & Srimathi Nagamani), my wife(Roja), my lovely daughter (Hansini) and son (Harshil) for their inspiration and continuous support in developing this Blog.

... "Things will never be the same again. An old dream is dead and a new one is being born, as a flower that pushes through the solid earth. A new vision is coming into being and a greater consciousness is being unfolded" ... from Jiddu Krishnamurti's Teachings.

Now on disclaimer :
1. Please note that my blog posts reflect my perception of the subject matter and do not reflect the perception of my Employer.

2. Most of the times the content of the blog post is aggregated from Internet articles and other blogs which inspired me. Due respect is given by mentioning the referenced URLs below each post.

Have a great time

My LinkedIn Profile
View my complete profile

Failure is not falling down, it is not getting up again. Success is the ability to go from failure to failure without losing your enthusiasm.

Where there's a Will, there's a Way. Keep on doing what fear you, that is the quickest and surest way to to conquer it.

Vision is the art of seeing what is invisible to others. For success, attitude is equally as important as ability.

Favourite RSS Syndications ...

Google Developers Blog

Loading...

Blogs@Google

Loading...

Berklee Blogs » Technology

Loading...

Martin Fowler's Bliki

Loading...

TED Blog

Loading...

TEDTalks (video)

Loading...

Psychology Today Blogs

Loading...

Aryaka Insights

Loading...

The Pragmatic Engineer

Loading...

Stanford Online

Loading...

MIT Corporate Relations

Loading...

AI at Wharton

Loading...

OpenAI

Loading...

AI Workshop

Loading...

Hugging Face - Blog

Loading...

BYTE BYTE GO - YOUTBUE

Loading...

Google Cloud Tech

Loading...

3Blue1Brown

Loading...

Bloomberg Originals

Loading...

Dwarkesh Patel Youtube Channel

Loading...

Reid Hoffman

Loading...

Aswath Damodaran

Loading...