Kubernetes and Docker: The Container Masterclass | Cerulean Canvas | Skillshare

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Kubernetes and Docker: The Container Masterclass

teacher avatar Cerulean Canvas, Learn, Express, Paint your dreams!

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

105 Lessons (7h 2m)
    • 1. CMC Promo

      3:31
    • 2. Course Outline

      1:53
    • 3. How to make a web application?

      4:21
    • 4. Demo: Simple Web Application

      2:28
    • 5. A forest of VMs!

      2:08
    • 6. Hello Containers!

      5:08
    • 7. Hello Docker!

      1:34
    • 8. Demo: Installing Docker on Linux

      3:45
    • 9. Demo: Containerizing Simple Web Application

      2:25
    • 10. Stages of Containerization

      0:53
    • 11. How does Docker Work?

      3:51
    • 12. A quick look at the format of Dockerfile

      2:25
    • 13. Demo: Fundamental Instructions of Dockerfile

      5:48
    • 14. Demo: Configuration Instructions of Dockerfile

      5:29
    • 15. Demo: Execution Instructions of Dockerfile

      4:31
    • 16. Demo: Expose Instructions of Dockerfile

      4:15
    • 17. Demo: Miscellaneous Instructions of Dockerfile (Part 1)

      4:07
    • 18. Demo: Miscellaneous Instructions of Dockerfile (Part 2)

      9:26
    • 19. Demo: Docker Hub Walk-through

      4:06
    • 20. Understanding Docker Images

      3:01
    • 21. Demo: Working with Docker Images | Search, List, Push, Pull and Tag

      11:37
    • 22. Demo: Know your Docker Image | Inspect and History

      5:31
    • 23. Demo: Clean up Docker Images

      1:48
    • 24. A Container is born!

      1:52
    • 25. Container Life-cycle

      2:54
    • 26. Demo: Container Run Vs Create

      2:52
    • 27. Demo: Working with Containers | Start, Stop, Restart and Rename

      2:58
    • 28. Demo: Working with Containers | Attach and Exec

      1:44
    • 29. Demo: Inspect and Commit Container

      3:29
    • 30. Demo: Container Exposure | Container Port-mapping

      1:52
    • 31. Demo: Container clean-up | Prune and Remove

      2:01
    • 32. Multi-container Applications and Introduction to Networking in Docker

      2:41
    • 33. Container Networking Model (CNM) of Docker

      2:28
    • 34. Docker's Native Network Drivers

      4:05
    • 35. Demo: Create Docker Networks

      1:41
    • 36. Demo: Working with Docker Networks | Connect, Disconnect, Inspect & Clean

      5:01
    • 37. Demo: Ping one Container from another

      4:19
    • 38. Never lose a "bit" of your data!

      5:26
    • 39. Demo: Working with Volumes | Create, List and Remove

      3:33
    • 40. Demo: When Containers meet Volumes

      3:45
    • 41. Demo: Working with Bind Mounts

      2:35
    • 42. Demo: Hosting Containerized 2048 game!

      3:08
    • 43. Introduction to Docker Compose

      1:09
    • 44. Demo: Installing Docker Compose on Linux

      0:53
    • 45. Demo: Structure of Docker Compose file

      6:57
    • 46. Demo: Wordpress on Compose

      7:20
    • 47. Demo: Introduction to Docker Compose CLI

      2:51
    • 48. Introduction to Container Orchestration and Docker Swarm

      6:47
    • 49. Can Swarm handle failure?

      1:31
    • 50. Demo: VirtualBox installation

      1:29
    • 51. Demo: Docker Machine Installation

      0:37
    • 52. Demo: Setting up the Swarm Cluster

      2:22
    • 53. Demo: Initialising Swarm Cluster

      1:54
    • 54. Demo: Working with Swarm nodes | List and Inspect

      1:44
    • 55. Demo: Creating a Service on Swarm

      3:45
    • 56. Demo: Making a node leave your Swarm

      2:47
    • 57. Demo: Scaling and updating with Swarm

      3:25
    • 58. What about the more popular one?

      3:30
    • 59. Kubernetes: An origin Story

      1:49
    • 60. Kubernetes: Architecture

      5:30
    • 61. Demo: Bootstrapping Kubernetes Cluster on Google Cloud Platform

      19:35
    • 62. What are Pods?

      1:51
    • 63. How to operate Kubernetes? Imperative vs Declarative

      1:57
    • 64. Demo: Working with Pods: Create, analyse and delete (Imperative and Declarative)

      9:41
    • 65. Life-cycle of a Pod

      1:15
    • 66. Demo: Managing Pod's lifespan with Life-cycle Handlers

      3:04
    • 67. Demo: Adding Container's Command and Arguments to Pods

      3:27
    • 68. Demo: Configuring Container's Environment Variables with Pods

      4:33
    • 69. Labels, Selectors and Namespaces

      1:50
    • 70. Demo: Working with Namespaces

      3:47
    • 71. Demo: Pod Resource management

      4:34
    • 72. Kubernetes Controllers | Concept and Types

      0:54
    • 73. Introduction to Replicasets

      1:08
    • 74. Demo: Working with Replicasets

      6:41
    • 75. Introduction to Deployments

      1:05
    • 76. Demo: Working with Deployments

      4:37
    • 77. Introduction to Jobs

      1:15
    • 78. Demo: Working with Jobs

      3:02
    • 79. Introduction to Services and Service Types

      3:40
    • 80. Demo: Working with ClusterIP services

      3:45
    • 81. Demo: Working with NodePort Services

      3:34
    • 82. Introduction to Storage in Kubernetes

      2:33
    • 83. Demo: Mounting Volume to a Pod

      4:47
    • 84. Demo: Mounting Projected Volume to a Pod | Secrets

      4:01
    • 85. Demo: Good old MySQL Wordpress combination with Kubernetes

      7:47
    • 86. Blackrock Case Study

      1:34
    • 87. Node eviction from a Kubernetes Cluster

      2:33
    • 88. Demo: Rolling Updates | Rollout, Pause, Status Check

      3:52
    • 89. Introduction to Taints and Tolerations

      2:22
    • 90. Demo: Scheduling the Pods using Taints

      8:48
    • 91. Demo: Autoscaling Kubernetes Cluster using HPA

      3:33
    • 92. Demo: Deploying Apache Zookeeper using Kubernetes

      18:47
    • 93. Pokemon Go Case study

      2:40
    • 94. On-premise Kubernetes or Managed Kubernetes on Cloud? Make a choice!

      2:46
    • 95. Demo: Setting up Google Kubernetes Engine Cluster

      5:39
    • 96. Demo: Accessing GKE Cluster

      4:08
    • 97. Demo: Persistent Volume and Load Balancing on GKE

      6:49
    • 98. Demo: Kubernetes on Microsoft Azure Cloud

      11:55
    • 99. Demo: Extra - Docker UI with Kitematic

      8:37
    • 100. Demo: Extra - Minikube Series | Installing Minikube

      2:15
    • 101. Demo: Extra - Minikube Series | Getting started with Minikube

      10:20
    • 102. Introduction to Serverless Kubernetes

      2:42
    • 103. Activating Cloud Run API on GCP

      3:35
    • 104. Your 1st Service on Cloud Run

      5:17
    • 105. Conclusion

      0:50
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

2,285

Students

--

Project

About This Class

Update 2021!!

  • Introduction to Serverless Container Platforms.
  • Getting started with Cloud Run and running your 1st container service on Cloud Run.

Containers

Containers are like that smart chef who can feed a whole family with just a bowl full of rice, and that's not an exaggeration at all! Containers are empowering businesses to scale fearlessly and manage their web apps hassle-free. They are the prime reason why micro and small enterprises are migrating to Cloud. All of this has undoubtedly led to an enormous demand for professionals with Containerization skills.

Which skills do you need?

  1. A platform to Create, Run and Ship Containers... like Docker.

  2. A strong tool to Control/Manage/Orchestrate your containers... like Kubernetes!

This Course takes you on a wonderful journey of learning Containers using key components of Docker and Kubernetes. All you need is very basic knowledge of Linux fundamentals like files and processes along with a bit of Linux command line.

The Containerization Journey with Docker:

Calling Docker the most widely used containerization platform would be an understatement. It has literally become synonymous to containers! Following topics covered under this course will solidify the logical base of this statement.

  • You can only love technology if you know how it works, and that's exactly why you will be learning Docker architecture and how its Components work.

  • At first glance, Dockerfile might seem like just another file describing app specifications. That's because it is probably the simplest yet efficient way to perform app building from scratch.

  • Docker CLI is intuitive and is inspired by your friendly Linux CLI. So adapting it is a piece of cake!

  • Docker images and Containers are the most portable and reliable way to ship your micro-service or web application without worrying about questions like "will it work on his infrastructure?"

  • Once you are fairly familiar with containers, Docker Networks and Volumes will open a whole new world of opportunities. Your containerization will become more reliable and will start serving its true purpose.

  • Docker Compose will combine all of the learning and take it to the next level with inter-dependent multi-container applications.

Once you have learned all of this, you will be craving to know what else can you do with containers and how you can take your containerization skills to the next stage!

The Orchestration Journey with Swarm and Kubernetes:

"With Great Power, Comes Great Responsibility"

Similarly, With Great amount of containers, comes a greater amount of orchestration!

  • You want to deploy 4 nodes on your cluster but can only afford to have one SSD node. And you gotta make sure that it only hosts containers which demand SSD explicitly. What to do?

  • You don't want to have idle containers chilling around your nodes and not serving even 10% of their capacity but you also want to make sure that your customers don't hit 404 when traffic is at its peak. On top of that, you don't have time or manpower to keep your number of web-server replicas in-check. What to do?

  • You are a pro-on-premise Kubernetes expert but your next project happens to be hosted on a public cloud platform like GCP or Azure. You're not scared but a little push will help you a lot! What to do?

This course is a one-stop answer for all of these questions. It covers both Kubernetes and Docker Swarm and makes sure that you are confident and capable to make your call when the time comes!

Even though a container orchestrator is nothing without containers themselves, Kubernetes seems to be the biggest breakthrough in the world of DevOps. This course explains Kubernetes from the start. No, I mean LITERALLY from the start (Origin! It,s an interesting story). It covers all of these important topics with examples so that when you finish this course, you can use and appreciate containers as well as we do!

  • Kubernetes Architecture (Components, States, Nodes, Interactions)

  • Kubernetes Objects (Pods, Handlers, Workloads, Controllers, Services, Volumes)

  • Operations (Sorting, Configuration, Scheduling, Scaling, Deploying, Updating, Restricting)

  • Application Examples (All-time favorite Nginx web server,Custom Landing Page, Stdout Logs, Wordpress blog with MySQL, Apache zookeeper etc.)

  • Kubernetes as a service (GCP, Azure)

  • Case studies (Blackrock, Niantic)

With that said, see you in the course!

NOTE: Course Codes Can be Downloaded from this Link

Happy Learning!

Meet Your Teacher

Teacher Profile Image

Cerulean Canvas

Learn, Express, Paint your dreams!

Teacher

Class Ratings

Expectations Met?
    Exceeded!
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. CMC Promo: Hi. Welcome to this container masterclass. Are you looking for a new or better job in develops? Are you interested in making a long term career as a Dobbs in Jinya? Do you think that containers, docker and communities are the best skills to pick up? Well, we must say your choice is great. Containers are one of the most game changing advances in technology. Industries on over the world are making their app development and deployment process faster , cheaper and more reliable. At the same time, even small startups are not hesitating to skill, since the financial risk and resources have lowered significantly. With such a large scale acceptance across the globe, containers have genuinely become a movement. As you might have guessed off. This has also resulted in significantly increased demands and opportunities for professionals and certified experts with containerized ation skills like docker and kubernetes. That's why if you look at Google trends, you can easily tell that these technologies are showing no signs of stopping. So if you want to learn containers from the basics and take your skills to a professional level, you're at the right place in right hands. We are a group off experience ingenious educators and certified experts on docker and communities, and we helped craft it discourse to make sure that with just basic knowledge off limits, you can proudly and peacefully learn the whole content. Speaking off content off the course, Docker is the most popular contain ization platform and Kubernetes is the most popular orchestrator, so it only makes sense for a masterclass to cover both. Totally starting from setups and Dr files, this course covers everything, including docker images, containers, networks, storage, docker compose and docker swarm. Once you have solidified your concepts of containers, you learn about the power off orchestration with kubernetes without rushing at all. You learn communities, architecture, workloads, services, volumes on a lot off orchestration tasks with interesting examples. You will feel the sense of accomplishment when you will bring your Web servers a WordPress block. Your favorite game are even an Apache zookeeper cluster tiny containers. You'll feel connected to the industry with really case studies off popular companies and products which used containers in recent times when everything is going to cloud, how can really contain us behind you will learn how to take your knowledge on hosted communities on public cloud platforms like Google Cloud and Microsoft Azure. That's not all goods and quizzes will make sure you don't make meadowsweet, syntax and semantics. Cheats will make a command divisions fun and quicker. Certification guidelines will help you choose proper exams and deter mined practice directions. We also acknowledged that containers are a growing technology, so both darker and communities are sure to help feature updates and new topics to learn. We will keep this course up to date to make sure you grow with containers as well. So what are you waiting for? Let's start or wonderful journey with contain a masterclass. 2. Course Outline: Let's talk about the outline off the course. We will start off with an introductory section where we will cover basics off of applications, containers and docker. Then we will take a deeper look into the architecture off Dhaka and learn how to write DACA files. At the end of the session, you will receive your first T cheat off this course. Then we will understand and work with docker images and containers using docker command line after understanding container networking model and how containers communicate in different situations, who will implement different doctor networks and play around them. Then we will take a look at different storage objects off Docker and create something using them, which will be both informative and fun. Once we're familiar with most of the doctor objects, we will take them to the next step where we can create multiple resources from a single file using docker compose. Then we will understand what orchestration means and do some basic orchestration. With doctors warm, we will make a close comparison between doctors warm and kubernetes, and when you are capable enough to make your choice between both, orchestrators will move to communities architecture and understand how it works. Then we will take a look at parts and other workloads off communities and perform a lot off orchestration for different applications. We'll also take a look at one of the most significant case studies off Kubernetes. We will see how to set up a news, hosted communities on cloud with demos and really unique case study, and finally will conclude the course with insight on certification exams. What these learnings mean for you and what kind of professional prospects would be potentially open for you. But that won't be the end off it. There will be a lot off upgrades and bonuses coming up regularly. Oh, and by the way, you can find all of the cords like Yamil file and Dr Files in the Resource Is section off this lecture. With that in mind, let's start learning. 3. How to make a web application?: before we begin to understand and work with containers in general, it is useful to take a quick look at how do we make Web applications some off? You might even ask what is over my application, since the term is quite widely used, but it is quite superficially explored. Just take a look at some of these examples. Productivity tools like G suit, social media giants like Facebook, video chatting applications like Skype entertainment platforms like Netflix payment services like PayPal or even the learning platform Like you. Demi itself are all Web applications in one way or another, which means you're using Web application interface at this very moment if we have to define it. Ah, Web or Web based application is any program that is accessed or a network connection using Http rather than existing within a devices memory. Off course. The definition is flexible, and you may choose to use one protocol or another. But on a broader perspective, it is all about not using your device like PC tablet or mobile for computing purpose. Instead, we let those mighty costly and reliable service do the heavy lifting, and we just access the result off are requested data from some Web interface Like http, this has so many advantages with just gon be overlooked. First off, all the performance off the applications will not be determined or limited by the hardware they are run on. It also means that we can almost say goodbye to those long lists of hardware requirements that we used to check before trying any new software. The requirements are still there, but they're quite standard, perhaps also improve speed. Now you might think that speed is just another performance perimeter. But here speed can refer to non Laghi performance, faster updates and overall faster growth off the organization. In general, the speed is also representative off shorter product development cycle. Since rollout off updates will be faster and user feedbacks can be taken and addressed quickly, as we just mentioned. Since the hardware requirement toe access, such abs are fairly generate. Like basic consumer toys and Web browsing capability, these applications can be accessed by wider range of devices by more and more consumers. In fact, many of the popular social media and utility APS also so variable devices the policy off not owning but accessing the data also improves the overall security off both consumers and hosts. And all off it leads to a better idea. Economy. It is not just about APS becoming cheaper after rise off her maps. Many revenue models, like Freemium be as you go and add based revenue generation have grown significantly. Not only Dad. The transactions have become more transparent on all ends like businesses, consumers and even the government's. Finally, the nightmare of business makers, which used to haunt them for decades, has become quite a Disneyland. Yes, we're talking about scaling companies don't how to invest in tow. Underutilized hardware taken skill as they grow since now, have we have a fair idea off? What are we maps and why do we use them? Let's get straight to the business. There are three steps to the process off making Web abs first, make it or build it on the suitable environment. Sickened. Wrap our packet with necessary support and instructions to ship or deliver it to the intendant line for consumer and finally rented all your machine or hosted on your server for others to access it. In next lecture. Who will get started with creating Web applications 4. Demo: Simple Web Application: Let's install Engine X Web server on our local machine, and the next Web server is the most vanilla example off a Web application. For your information, we are running open to 16.4 on this machine. And now let's start with switching to the root user privileges. As you can see, we have moved to root privileges. Now we can start our installation by first ofall downloading the PGP or pretty Good Privacy key for Engine X. The purpose off doing so is to make sure that when we install in genetics, the binaries are verified. The key has been downloaded. Now let's switch to E T. C slash AP directory with a less common let's list out the contents. We have a bunch of files here, but what we need is sources Start list file. So let's open sources dot list with Nano text editor. You can use any text editor you like, but in this course we will mostly stick to Nano. As you can see, this file contains a lot off links. Thes links our sources for open toe to find updates at the end off the file based thes two lines. These lines indicate the update part for engine X application when it gets installed, and we updated further in the future. It saved the file and exit Nano just to make sure we don't have any dangling into next installation. Then app get removed and the next common. This command will make sure that any off the previously installed instance off Engine X installation is completely removed. Now let's an app get of date to reflect the changes we have made in sources. Start list file. That's you see D command twice to go back where we started. Now let's install Engine X using apt get install in the next command. Once the installation is complete, we can verify it by going toe Web browser. An opening local host on Port 80 Well, the installation was successful. Engine X is earning properly. This was an example off installing and running the most Simple and vanilla Web application engine X Web server 5. A forest of VMs!: We have seen the advantages off where maps and how great here. But it doesn't mean that this coin doesn't have a flip side. There's just so many robots available on the market places. There are so many clones off some of really good ideas, and also many Clickbait applications, which turn out to be nothing but endless add boards. And unfortunately, even tat market is showing no signs off, stopping at all. And while the liberty off choosing the APP is still in the consumer's hand, all off these abs are being hosted, and they're generating traffic, occupying physical memory and storage in some off the data centers While working with mediums. It is pretty common toe have issues where the application was working smoothly on developer environment, but it was a train wreck on office machine. On even worse, it crashes on the client machine. Since we help transition from waterfall toe agile and a gentle develops models, updates are rolling out faster than ever. You. And if you are unaware off these models, just ask yourself this. How often did you receive updates for soft rest 10 years ago, and how often a year do you abrade the Facebook app on your mobile. While faster updates are good for businesses and consumers, it brings huge responsibilities on system Edmunds to make sure none of the updates compromised the stability off the app and to reduce downtime as much as possible. We end up using even more V EMS, all of the's Internet enabled application and rise off data. Science is generating huge amount off later and populating up thousands off servers every day with data basis or were all the use it off. Williams have just increased significantly. You do an option off their maps and micro service models, and, as you might have imagined, it has resulted into nothing but forests off servers all around the loop. 6. Hello Containers!: containers on abstraction at Application Layer, which packages codes in dependencies together, let's city a great and expand this definition further. Cadenas on abstraction at Application Leah, which packages cords and dependencies together. It means instead of just shipping the applications, container ship the application on during time environment as well, and he still managed to remain small sized. How? Let's compare them architecturally with Williams. In a traditional William architecture, we have, ah, hyper visor like hyper V or give'em on top of hardware infrastructure. These are also called type one hyper risers, since they don't need a host operating system. The guest horse a provision on top of hyper wiser and they acquire that isolated virtual environment. In some cases, we get type two hyper wiser, like Oracle's Watch Jewel box, where we do need a host operating system, and the rest of the part lays out pretty much the same. And this is how we in dysfunction, in a very broad sense, coming back to containers. The biggest difference compared to Williams is they don't have guessed operating systems, container and time environment is used instead of hyper wiser. What is it you may ask for now, Let's say it is software which manages and lands containers. Containers contain the application court on the dependencies, as we have just seen, The dependencies don't only mean external or third party libraries. It also means always level dependencies. The logic behind such implementation is all of the Lennox variance share the same Lennox colonel well, more or less so. There is no point in duplicating the same set of files or and or in multiple Williams if all containers can just access them in their own isolated environment. With that said, what about the files, which are uncommon or to be free size? The files, which are specific to the Oise? Well containers will contain them along with the application. And since the process off making the containers and running them are done by the same container and time environment, there will be no conflict off environment. If this information is too sudden for you, don't worry. The intention off mentioning all of this is just to let you know that how containers can attain same level off isolation as Williams, but while sharing the resources with host always instead of duplicating them and what happens because off that well containers consumed less storage and memory without stretching the facts at all. Gigabytes literally turn into megabytes. This way. Shipping them is easier as well. We don't ship the whole Wiens or a long list off instructions. We just ship ready to run containers. And since all of the necessary dependencies are also packed with the containers, is it worked on the developers environment? It will work on your machine as well, since we have reduced that resource is scaling becomes easy and cheaper. Even though you need to create 10 more replicas off a back and container, you probably want how to spend money on buying or renting a new server. In fact, if you need to roll out updates, you can still keep your applications running by extending your number off replicated containers, and you may achieve zero downtime. All of this sounds attractive and groundbreaking, but if we relate this to industries who are actually using containers well, Google pioneer using orchestrated containers years ago when they started facing or whelming amount of data. These days, companies like Expedia, PayPal and GlaxoSmithKline are Wallenda re providing themselves as the references and case studies apart from them. educational institutions like Cornel University and gaming giants like Niantic, which became a huge success after Pokemon go on all using containers, companies are gradually migrating to containers as many off you might already know. Drops jobs are increasing rapidly and containers are an essential part off the whole develops movement. In the next lecture, we will finally introduce ourselves with Docker and we'll get started with learning it. 7. Hello Docker!: It is time that we get started with the key player off our course. Dr. Docker is an open platform for developers and cyst amendments toe build, ship and run containerized applications. In other words, it is a container ization platform. His doctor the only platform off its kind. Well, no, Certainly there are others like rocket, but doctor is definitely the dominant one. By the time discourse is being created, doctor is tried and tested and it is a top choice off industry unanimously. It means if you want to sharpen your container ization skills, Docker is potentially the best choice for various reasons, such as more industries are using it so it can land you on more religion jobs. It is open source and has huge community support. Ah, lot off third party applications are available to support DR. Although it is built for Lennox, it can be used on Windows and Mac OS. For those who just don't have any other choice, there are other aspects as well, but there is no point on flooding your heads that information, which you might not be able to relate to, who will get into those later into this course. In the next lecture, we will install Docker on a Lennox machine 8. Demo: Installing Docker on Linux: In this demo, we will install Docker on open to 16.4 or even to Zaenal. Let's start off with running a standard apt get update Command. Once we're done with that, let's install some off the prerequisites, such as at transport https to make sure that our machine can communicate through https authority certificates, Go and Software properties Common, which contains some off the Golan objects which will be used by Dr and the installation is successful. Now let's download GP geeky for Docker and added toe on machine. And to make sure that we don't get a long list off processes which happen in the background , let's use hyphen f s s l flag to keep our reserve as small as okey and it shows OK, which means we got our GP geeky. Let's verify this key using pseudo app key fingerprint common. We can verify that we have received the correct key by searching for the last eight characters off the fingerprint, which should be zero e. D. F. Cd 88 This information is provided by Dr Itself, so that is not much for you to figure out. And yes, our key does have those characters as its last eight digits. Now run this command toe. Add a repository called stable and at the content off download dot docker dot com slash Lennar's slash Cuban to on it he helped provided the flag ls be underscored. Release hyphen CS to make sure that Docker provides correct files, which means files for Urban two senior are open to 16.4 to our stable repository. Let's run the update again to reflect the changes. Then Sudo apt get install Dr C E to finally install docker hyphen C E stands for Community Edition, which is one of the two additions provided by Docker. The other one is called Enterprise Edition, which is not free, so we won't be including it. In this course. The process has ended and we have successfully installed Dr CE or Docker community addition verify that our installation is successful by running pseudo docker run Hello World Command . This will run a container called hello world, which would only be possible if the doctor installation was successful. You don't have to pay much attention to the processes which are going on because we will be exploring all of them insufficient death in further models, as it says are, installation appears to be working correctly. You may have noticed that we have been using root privileges over and over to make sure that you can run Docker from your regular user as well. Let's perform a few more steps. First, let's add a group card docker using pseudo group at Docker. Now let's add our user, which is 22 this stalker group, and provided root privileges. No, let's try to run hello World container without root privileges with just Doctor and Hello World Command and we get the same results. 9. Demo: Containerizing Simple Web Application: in first demo we had installed and run engine X on open to 16.4 locally in the demo. After that, we installed Docker. You might find a pattern here, and you might have been able to figure out that in this demo we are going to run in genetics as a docker container. Unlike Hello World Container, we will do this in a bit more elaborate way. Let's start with pulling an image called Engine X latest from Docker Hubs Engine X repository by running the command Docker image. Pull Engine X, Kahlan Latest. This will download or pull an image called engine X with latest attack, which can later be run as a container. Let's see if we help God. Our image on Docker Images Command to show the list off images, and here we go. We helped to images. First is Hello World, which we used in the last demo, and second is Engine X, which were using in this demo. Both of them have attacked, called latest and they have different sizes. Now let's run this image as a container using docker containers uncommon, followed by I T D flag and name or Cantina Web server engine X with hyphen b common. We are mapping the port 80 80 off our local machine to contain a sport 80. And finally we're mentioning the image name and the next latest, which we have just pulled recently. What we got is a container I d off the engine X container. I know all of this terminology sounds pretty new and pretty abrupt, but don't worry in this demo, our only purpose is to run into next successfully. We will go through all of these terms in sufficient details. When the time arrives. Let's verify that all container is running by running the command docker PS hyphen A. And as you can see, Web server engine X container is running, which is built upon image called engine. Next latest. Finally, let's see the output off this container by going to the Web browser and opening our local host sport 80 80 and it works successfully 10. Stages of Containerization: in previous model we got introduced to containers and then an instance off it. In this section, we will dig deeper into the process off Contain ization with reference to docker before understanding Doctor in detail, it will be efficient to visit a few times. Briefly doctor, files get built, Docker images get shipped and containers are run. You can consider Docker file as blueprint off Docker image if you remember. Well, we have already come across Docker Image and Docker container in our engine X contain a demo. So now that you know all of these three files definitely not in detail. But at least Wigley We can move on to the architecture off, Doctor and come back to these files later. 11. How does Docker Work?: No, the natural progression of talk would be. How does Dr Work Docker Ecosystem has a number of offerings where some of them are more useful than the others? We will begin with Docker Engine, also known as DACA in general, and we'll look at other important ones as we move further with this course. Let's take a look at the architecture of Dr Darker and the whole process off. Kontinen ization revolves around three main components. Docker Client, Dr Host and Docker Registry. Dr. Klein is the machine are medium, through which we as users, interact with docker. The two basic ways off interaction are doctor CLI with stands for command line interface on Docker AP Eyes, which again stands for application program. Interface commands can be directly used from clan terminal, whereas AP ice can be used to make some applications. Doctor Doctor, as we have seen in our earlier demo, both Dr Pull and Dockery on our commands covered under DACA CLI, we'll explore more such commands as a cover for the topics. Dr. Host Dr Host is the machine which actually performs the task off, contain ization. It runs a program or piece of software called Docker demon, which listens to and performs actions. Asked by Docker client Dr Niemann builds docker file and turns it into a docker image. Doctor files and darker images can directly communicate with Dr Demon. Either images can be built from docker File are they can be pushed or pull from Dr Hub. In any case, that task is to be performed by Dr Host using Docker demon. Dr. Images can also be done as containers. Containers can communicate with Dr Demon by Dr Images. In other words, any changes made to the container are also reflected on the docker image. Temporarily well explode these parts individually soon enough. It's possible that Dr Klein and Dr Host are actually the same machine as well. But the function off Dr Klein as a piece off software is limited toe passing the user input and displaying output provided from Dr Host Human Find. Docker Registry has the simplest component off the locker architecture. It serves as a place to store docker images and to make them available to others. The engine X image, which we used earlier in our demo, was pulled from Dr Registry Dr Plan talks to Dr Demon Bi directionally where it passes the request and receives the results. Where is Dr Demon and Docker Registry can talk bi, directionally push and pull images. Let's some off all of the's three components off Doctor architecture. First of all, we have Doctor Client, which process requests through Dr Seelye and A P IES and receives results to be displayed. 10. We heard Dr Host, which also and Stocker Demon and works with docker images and containers. Finally, we hold Docker Registry, which acts as a universal place toe access available docker images. Now we can go back to those 34 months which we saw earlier. Dr Files, Dr Images and Containers, which respectively represent, build ship and run in the next lecture will take a detailed look at how Dr Files work. 12. A quick look at the format of Dockerfile: we can now go back to the 34 miles, which we saw earlier. Dr Files, Dr Images and Containers, which respect to, represent, build, ship and run. First, let's focus on docker file. It is a sequence ships set off instructions intended to be processed by Dr Demon Availability off such format replaces a bunch of commands intended for the build up off a particular image. It helps keeping things organized with time. It has also turned out to be the primary way off, interacting with docker and migrating to containers in general. As for working it, sequential instruction off Docker file is processed individually, and it results in a file, which acts as a layer off the final doctor image, which will be built. A stack off such sequence layers managed by a file system, becomes a docker image. The purpose behind this is to enable cashing and ease up troubleshooting. If to knocker files are going to use the same layer at some stage, darker demon can justice. He used the pre created layer for such purposes. No, let's look at the structure used for writing the doctor files. Firstly, it is a file with no extension at all. And a general rule of thumb is to name the file as docker file with D capital and no extension, you can use any text editor to create the file. Just make sure you don't put an extension. The purpose behind doing so is to make the file compatible toe pass for auto builders used by Dr Toe. Build the images although it is not an ironclad rule. And you can name the docker file according to your convenience as well, which we will look in the future Demos. What you see inside the docker file our instructions, Toby passed on the instructions can be generally divided into three categories. Fundamental configuration and execution instructions. In next lectures, we will write our first docker file and understand these instructions one by one. 13. Demo: Fundamental Instructions of Dockerfile: Let's write or first Docker file and understand its fundamental instructions. Let's see, what is your current working directory? We are in the 20 directory, which is the user's name on that home directory. It is quite likely that you would also be in a similar location once you have downloaded the material provided in courts and lecture notes and unzipped it. You should also have a directory called CC underscored Docker, where C, C and D are capital. We're only looking one level deep three in our present directory. And if three is not available on your machine for some reason, you can verify the CC. Underscore Docker directory simply using L s command. Now let's navigate to the CC docker directory Just to get you familiar with the structure of the directory, you will find one directory for each segment or module and subdirectories for respective demos. If you don't intend to write the files by yourself, why learning you can simply use the appropriate files for each demo and run the results. Let's go further toe as to directory, which contains all of the required cords and files for this segment. We are in the S to at the moment. Finally, let's navigate to the directory name D one and verify that we are anti right, please, for the Let's create an empty Docker file, which touch command. I'm creating this file because I want to show you step by step, how to write a dr file, But you will find a predate on docker file in the directory were using Nano as the text editor, But again, you're free to choose the one you might be comfortable with. And with this, let's open the empty Docker file and start writing it. The first instruction that we're providing is the A R G R Ark. Instruction art is used to define the arguments used by from instruction. Although it is not necessary to use art and not using so does not cause any harm to the resulting image directly. Sometimes it helps keeping parameters such as versions under control. Here we have defined argument. Good underscore version equals 16.4 which means that we are going to use something which will have the court worsen 16.4 in a pretty tough since. Remember in a very rough sense, you can treat it as a declare a bill directive in general programming such as Macros. But again, this argument will only be relevant for the from instruction and next is the from instruction from is used to specify the base image for the result and docker image that we intend to create in any case from instruction must be there in any doctor file, and the only instruction that can be written before it is the art which we just saw generally from, is followed by an operating system image or an application image, which is publicly available on Docker Hub. Here we want tohave open toe as our based operating system image with court version, Our toys version 16.4 So the name off the image is followed by a Kahlan, and argument is mentioned in curly braces, preceded by a dollar sign. As we have already mentioned in our instruction, our court worsen its 16.4 so it will be passed as an argument, and the based image for this doctor file will be considered as we've been to 16.4 to add a little more substance to the image were also including a set off run and CMD instructions, but we will explore their meanings and applications in next demos. For now, let's just save this file again. It is important to remember that we must not give any extension to the docker file and should mostly name it. As Docker file itself, it is time to build the docker file and turn it into an image. Let's do it with Dr Bill Command. The hyphen D option is used toe tagged the image or, in other words, named the image to make it easily recognizable. We'll attack the image as I am g underscore from. And the dot in the end directs docker to the docker file stored in the prison directory. As you can see the images being built up step by step, let's understand each of these steps first, step off storing argument was fairly simple, so it finished quickly. Second step involves setting of the base image, and it is doing so by pulling multiple file system layers from Docker Hub and stacking them in proper hierarchy. Once it is complete, it moves to the third step, which is to updated toys, and we have already provided the permission with wife flag where? Why stands for yes, Once he steps are done, our image is big. We can very fight that the image is built. Why are Docker images come on? As you can see, we have four docker images among which I am g underscore from is the one which we created recently means 11 seconds ago while others are previously created or pulled. 14. Demo: Configuration Instructions of Dockerfile: in this demo will go a step forward with writing doctor file and will explore configuration instructions. Again, We're in S two directory, which contains individual directory for every demo. Let's navigate to directory called D to There we go. As you can see, there is a DR file already present in this directory. Let's open it with Nano. As you can see, this docker file also has a base image off open to 16.4 mentioned using from instruction as described in previous demo. But this time we have skipped using our instruction and directly provided the version number. Now we have run and envy, which are configuration instructions, although they are not the only entries in the list of configuration instructions. But these are the ones that we will cover. Income demo. Let's go through them. One by one, John asks Docker to execute the command mentioned with it on top off the base image, and the results are committed as a separate layer on top off the base image layer. Here we have more than one mentions off run, and each one creates its own separate lier with the first run instruction we have provided to commands toe update the S install Carl and clean up later on. Where is the second run? Simply makes a directory named Cords Under Home Directory. Don't confuse it with our host machines. Home Directory Toe Here we're talking about based image, always Home Directory and the courts will be created on that base image, not on our host machine. Then we have used E NV, which is another configuration instruction. It does what its name suggests. It sets up environmental variables. We have used it three times to set user shell and log name environment variables just like the previous demo we have you CMD but we'll go into that later. Again. We will use the doctor Bill Command toe build this image. But this time we will tag it as I am G underscores on hyphen envy to separate it from the previous image. As you can see in this build, the first step is directly involving setting up the base image. Since we have skipped abusing our instruction, Step two will perform all of the commands used in first run instruction and will perform the commands off second run instruction, which is making a directory step 45 and six will set environmental variables as mentioned in the Docker file, and the super fast Step seven will get our image ready to run. Let's list out are available images with Docker images Command. These images are the ones currently available on the host. Our top image is that I m g underscored Run, envy, image. Now let's go one step further and run this image as container with doctors and hyphen i d d command the I e. D represents interactive teletype enabled and detached respectively. We're naming that to be running container as Kant underscores Run envy And the target image is I am G underscored Run and we which we have just created. The command was successful and we have just received the unique container idee provided by Dr for our Container. Here we have two containers earning, among which first is the one which we run recently. It is up means running for five seconds and it is ending the bash common. Now let's execute or containers bash command here The bash common and the process was running in background due to the detach flag set while running the containers. Now we had bringing it forward. As you can see now we're in the root directory off her. Kant underscores on in we container. Let's list out the directories here. Yes, the structure looks similar to a regular Lennox instance. Now let's verify the environmental variables, which we had set with Ian Reconstruction while writing the Docker file. As you can see, the user shell and love name variables are just as we had set them up. Now let's navigate to Home Directory As we list it out. We can also verify the creation off the cords directory, which was supposed to be created from our run instruction off the docker file. Finally, we can get back to our host and Weinmann by exiting the container using simple exit command . 15. Demo: Execution Instructions of Dockerfile: we are back in our S to directory. Let's navigate to directory the five and list out the contents off it. We have a Dr file for this demo stored in here. Open it in a text editor. Multiple new instructions. We have been using CMD a lot in the previous demos, but we will dig deep into it in this demo. Let's start with the most basic yet important instruction from will set open toe trustee as the base image for this doctor Image label is a key value pair, which adds the meditator toe, the image we have added to labels as key value pairs in multi line argument for a label instruction create a key has a value civilian canvas, while version key has 1.0. Next one is a run instruction, which will a bleed the package list off the base image in not interactive manner. Then we have entry point. As the name suggests, Entry point will allow the user to configure the container at a starting point. In other words, Entry Point will bring back the container to the starting point whenever a container is said to restart. For this talking image, the entry point is defined in exact form, which is also the preferred one. It will execute Ping five times when the container starts running. Last but not the least. It's CMD instruction we have seen so far that CMD provides the default command to the executing container. But if Entry Point is mentioned in the docker file, then CMD will always be executed after entry point. When CMD is defined in exact form and does not contain the executable, then it will be treated as a parameter off the entry point instruction. There can only be one cm the instruction available in docker file among multiple CMD instruction only. The last CMD instruction will be in effect for this docker image. CMD instruction is an exact form without executable, which means that it will provide the local host as the parameter for the executable off entry point, which is thing. If we sum up entry point and CMD here, we have set that maintainer toe pink the local host five times. As soon as the container is up and running, let's exit from the docker file and build our image sequence. Shelly, we will build Docker image based on the docker file in current directory and tag it as I am g underscore and three cmd build Context is sent to Dr Demon and it will download the open toe trustee image from the Docker hub to our local doctor Storage. Now based image has been downloaded and it is running in an intermediate container toe build open toe trustee environment. To build our application, Steptoe will create labels for our docker image. Step three will execute Theron instruction, which will update the open toe trustee base image and comic. The result in a new intermediate container step for will set the starting point off the container at ben slash ping. And the last step is CMD instruction, which will provide the local host as the parameter to the entry point to execute and to start off the container. At the end, all the layers will be stacked sequentially by Dr Demon and a final I am G underscored entry CMD image will be created with its image i D and latest tag. Let's check out the list of images available in our local doctor storage. Which doctor images Come on. As we can see, I am g underscore entry CMD Colin Latest has been built and stored on our local doctor stories. It's time to run a container based on that image type doctor run, hyphen, hyphen name, con underscore and three cmd, followed by I am G and three cmd but its end up and here we go Cantina is pinging our local host as for entry point and CMD instructions, and it is successfully pink. The local host for five times five packets have been transmitted and received successfully without any packet loss, which means or application is earning perfectly. Now let's check that status off on entry. Cmd with Dr Pierce hyphen A. Common as we can see, the container has exited with an error. Court zero after finishing its default task, which means containers execution was successful. 16. Demo: Expose Instructions of Dockerfile: Let's navigate to the six directory and list out all of the contents off it. We have a docker file for this demo. Available here. Opened the docker file in the text editor. As we can see, it contains four. Dr Instructions from instruction will set the base image Cuban to Colin, 16.4 as its base image for this docker image. Next instruction is run, which will update and install into next on open toe 16 points out of four base image. We will chain Subcommander off run instruction with Logical and Operator, which means in order to run second subhuman first common should be a success here. If we consider the sequence apt, get update off the base image should be a success. In order to install engine X after engine X installation AB get removed. An arm r f slash war slash lib slash ap slash list will clear up Local depositories off retrieved packages. Next instruction exposed is a type of documentation which will inform Dr about the board on which the container is listening. Keep in mind it does not publish the port, but it fills the gap between the doctor image builder and the person who runs the container . We have documented with exposed instruction that this engine next container will listen on port 80 cm. The instruction will make engine X application run in foreground by turning off engine X as a demon process. Exit from docker file. Build the Docker image with Dr Bill Command from the doctor file available in the present directory and tag it as I am g underscore exposed. The bell context is sent to Dhaka Demon as we already have open to 16 points in all four emits in local doctor stories. Dr Demon does not download it again. It is cashed in Step two. Jane Drunk instruction is being executed one by one. First, it will update the package index off the base image open to 16 points out of four. After successfully a bleeding, the image and Gen X will be installed on the base image and at the end, local reports off retail packages will be cleared up. Step three is to expose the port 80 off the container in order to inform Dr that engine X ab will listen on Port 80. The last step is setting up the deformed command CMD, which will set the engine x app as the foreground process in this container. Our image has been successfully built and tagged as I am g underscore exposed. Let's list out all the images in our local doctor storage. There we go. I m g underscore Expose has been successfully created and stored on DACA. Let's run a container based on I am Jay Exposed Image. My doctor and hyphen ITV hyphen hyphen arm Adam flag will automatically remove the container once it has stopped. Follow it with container named con Underscore exposed, followed by hyphen p 80 80 Colin, 80. Which means map the Container Sport 80 with host sport 8080 in order to access engine ex service and finally really give the image name, which is I am G underscore expose press enter and we got to contain a I D. That's list out. All the running and stop containers with Doc appears hyphen. A command or con underscore. Exposed is up and running for seven seconds. The containers Port 80 has been mapped on Port 80 80 off the host so that we can access and the next Web server on our favorite Web browser. Now go to your favorite Web browser, minus chrome and type http local host calling 80 80 in the and a spa press enter and we concede the default home page off injure next Web server. 17. Demo: Miscellaneous Instructions of Dockerfile (Part 1): Let's have a reality or PW d check. All right, We are in Demo eight directory and has always been released out. The components we can see to Dr Files now, before you can raise your eyebrows with a ton off surprises like Why? Why do we have to Dr Files in one directory? Isn't that a bad practice? Wouldn't doctor get confused? Allow me to clear a few things here. There definitely can be more than one doctor files in a repository or a folder, but they can not be named as docker file. Firstly, you're always won't allow that. So there is not much to argue. And secondly, naming it as Docker file has just one purpose. Make image building command smaller. Using docker help Auto builder. If we simply have files for different names, which are essentially Dr Files, Doctor won't bother about it. It will simply build the file we mentioned with that. Out of the way, let's have a look at these files we have Child and Parent Docker file. So let's give proper respect to the parent. Henry, you at first. All right, so this is a docker file and the right up It's pretty simple. We just have three instructions among which do are fairly familiar to you. The Middle window is a new entry on our Learning Co we have on build instruction. Its purpose is pretty simple. It allows us to specify a command which will be passed on to the next image that will use this image as its base image sounds confusing. Well picked this example. We help open to 16.44 as our base image, and we will create some image from this docker file. Now, if that image will be used as base image off another doctor file, it will be just like 1 to 16.4 since CMD can be over written by next docker file CMD or entry point instruction. So if we want to help some changes persisting while using this image as based image like having a file called greetings dot txt, created in the temp folder we need to use on bill instruction, we are a coined the sentence Greetings from your parent image toe, TMP slash greeting start txt and expecting it to exist whenever we used the image created from this doctor file as base image with that clear in our head. Let's exit this file now Let's open child Docker file. We just have to instructions. 1st 1 mentions the base image called Papa Open Do latest and read it that come from. You may wonder it is the name off the image which we will soon build and we're running Bash with CMD instruction. I really we want Papa Bentos greeting start txt to be visible in this image. Now let's build the parent image using docker build hyphen F common, followed by the name off Docker File Target Image name and adopt to indicate the president directory. Similarly, let's build baby open toe image from Child Docker file. Check this out during first step off setting up base image. It is executing a bill trigger, which has been inherited from on bill instruction off base images. Docker file. Let's see if both of her images are listed or not. Yes, they are John, a container from baby open toe image and name it baby container. When we execute this container, we had straight to the root off its base images open toe us. Let's navigate to TMP director using CD and see if greeting start. Txt is present. Yes, it is here. We can also cap it and verify its content. Which is to seem that we had a court into it. We can exit this container since our on bill demonstration is successful. 18. Demo: Miscellaneous Instructions of Dockerfile (Part 2): Welcome to the Conclusive Lecture Off Docker file section. In this lecture, we will achieve three objectives. Understand and implement container health Check using docker files do the same with stop signal instruction, and while we are added, we will also contain eyes a sample flask application. As always, we will start by knowing our present working directory, which is the moon nine under CMC. If we checked the list of components, we helped three files this time. Apt Art by docker file and requirements start TXT, which is a text file. Let's explore them one by one, starting with abduct by. We're looking at a sample flask application toes or familiar with fight on and have worked with flask earlier will find this file a piece of cake and those who have not touched upon flask. Don't worry, there is nothing Incomprehensible. Flask is a Web server Gateway interface framework. In other words, in case off fightin, it allows Spuyten application toe talkto Web servers in orderto forward and receive web AP requests and responses. We have started our file with a simple import statement to import flask class from flus library or framework. If you're wondering why in the world. Would we have flask framework or Pitre installed? Hold your breath. Those pieces will join the puzzle soon enough as well. Next up, we're creating an app instance from flask class. It's argument is name. This name String can be replaced by any other that you like, but it is recommended to keep it name if we are running a single model application. When the flask app is compiled, name is replaced by Main, which will make our instance. The main instance. Next line is a decorator, which is a rapper to describe a function using another function as its argument. The purpose off this decorator is to shout the incoming requests to forward Slash, which is comprehended as local host Port 5000. Next, we're defining the function, which will run within this Web application. Instance. It is called C M. C. And it was simply help printing a string called Welcome to the Container, masterclass by civilian canvas as its returned value. Finally, we're instructing flask that if our instance is mean, which it is, then run this application and make it publicly available. Let's exit this file Next up. We have the smallest file in the whole course called requirement dot txt. If you remember, during container introductory theory, we had mentioned that containers reduced a long list off requirements. Witness it. We just have one entry in the file called requirement dot txt, which is flask version 0.12 point two. But we will not mended you to install that externally either. After all, containers are isolated and one mints so every installation should ideally happen during the imagery in time itself. Ideally, speaking off images, we need a doctor file toe build this app. So let's exit this file and open tap. Starting off, we helped open toe base image and we're running an update and installation off. Bite on pip and call. We're copping all off the contents off this host directory toe app directory off base image and making it working Directory. Next up, we're installing contents listed in requirements. Start txt. We could have simply mentioned flashed there, but this is a standard practice to list out your requirements in a separate file and install them using the file itself. It also makes the readability off the docker file simpler for other developers now that are prerequisites are set up. We can then app not be white as a pipeline application. Using CMD instruction before CM Lido, we have health check instruction. Health check is a way to perform a user defined or developer defined periodic check on container to determine whether it isn't desired situation. Also known as healthy or not, this instruction comprises off three aspects are three types off arguments in double time out and come on in total defiance a timeframe after which periodic health check will be depleted. We have kept it 10 seconds, which means health check will be performed on the running container every 10 seconds. Time out, little minds went toe back off. If the container remains unhealthy, backing off would imply to perform a container restart. This brings us to another question. How do we don't mind if the container is unhealthy? Dr acknowledges the fact that every container or application would have different definitions off being healthy. For example, in this flask application, just because resources are properly allocated and the container is running does not mean the application is working correctly. What if the Web server is not solving anything? What if we come across 401 or 404 errors where the desired webpage would not be available. It would completely kill the purpose off this application in the first place. That's why we help command or CMD argument. The argument executes commands followed by CMD, and the results define whether the container is healthy or not. So it is up to us to provide the proper commands which can correctly deter mined container situation. In this case, we're providing a command with logical our condition, which means either this are tapped. Our first command is calling local host on Port 5000 which would display the result off flask application. But we help attached a failed flag to it, which means that if the common encounters enter 401 or 404 it will not show any output. Not even that default response such as this speech cannot be displayed etcetera. In that case, second command will be performed which returns exit status. One reason for writing the second command in such a way is that health check instruction considers one exit status as unhealthy. So we are going the address serving flask application every 10 seconds, and as long as it doesn't encounter any solving era. It will not written exit status. One which will mean the container is healthy and in any case, it does encounter ever 401 or 404 It will don't exist. Status one, which will mean the container is unhealthy and t off. Such alterations will cause a back off. It is mandatory to write health check before CMD instruction toe always overriding it. Next is stop signal when we terminate a docker container Doctor sense Sick dome signal toe . The Lennox process responsible for running the container sick dome gracefully kills the process, which means it clears out all of the cache and memory before detaching the process from X parent and freeing up resources to be used again. But it might cause a crash or endless loop if there's a fatal error or vulnerability exploitation in the application, which means it becomes necessary to use SIG kill instead of sick Tom, which immediately kills the process. Stop signal allows you to replace that before sick Tom with the signal you desire to provide. In other cases, you might even have to use SIG. Us are one or six top, depending on the nature off your application were replacing sick dome with PSA kill in stop signal instruction. With that said, Let's save this file and exited. Let's build the image and name it flask up using docker. Build common. The building is done. Now Let's run the container out off it and call it flask. There we go. No, let's have a list of thes containers. 1st 1 is flask, and if you take a look at its status, it shows up and running along with healthy, which means the health check is being performed. If you want to verify whether the health check is correct or not, Local host on Port 5000 and there we go. It's the output off our flask application. Finally, let's stop the convener. When we list over containers again, we can see that flask has just stopped recently, but unlike other containers, it stopped with a record 137 which in terms off Lenox indicates exit court off the process , terminated by sick, ill or stop signal instruction, also worked correctly. It seems like we have achieved all of the three objectives off this lecture, so see you in the next one 19. Demo: Docker Hub Walk-through: it is about time to go beyond our little host machine and get to know the wide community off. Doctor. The best way to do so is to get started with Docker home. Get back to our web. Rosa Goto help that, dr dot com And where we land is the room pitch off, doctor, Huh? Dr Hub is a cloud based service hosted by Dr Itself, which allows you to build, link and manage your doctor images. It also provides some off the production great useful features like automated build. Just for your information, the auto build it that we used in our previous section where we did not provide any name off file while passing the bill Common. And yet, Dr Build the Content Off Docker file is also hosted by back and service off Doctor Hub To access its provisions in first, we need to create an account which is totally free, and all it needs is a generic set off data like user name, email, I D and password. Once we have added that, let's agree to the terms and services and prove that we are not robots. After this step, you should receive an email on the idea that you provided and you should click on the activation link. I mean, that's obvious, right? Once you have activated your account, you will land on a page. We should look similar to this one. It is card the dashboard. It displays your user name and provide links to almost everything that you might want to do on Dr Hubbert. First of all, we are on the repository stack where you can explore the globally available repositories or create one by yourself. You can also create an organization which SOS as a unit off people management about reposed themselves. It is useful if you are not an individual, but you're acting for an organization or on behalf, often organization. And since we have not created any polls yet, we don't have any start repose our contributions in general. On the panel about these steps, we have a few lings. First off them takes you to dashboard where we already are so clicking on it will be pretty much pointless. By clicking on the Explorer option, we get a whole new world off popular repositories created by individuals and organizations around the world. To be honest, one of the aspects, which makes doctors so popular and loved Among the ingenious, is toe enormous contribution by the community in such a short time, and the fact that Dr acknowledges its importance and provides one place toe access it. All these reports are ordered by the number of pull stay have received, and our Engine X, which was used in our first hour container of discourse, is on the top of the list organization option provides us another willing to stuff regarding organizations and create menu provides us a list off options where we can create either repo organization on an automated bill. An automated build can be created by providing bill context, which is generally a repository containing the docker file named Docker File on your host machine. In other words, it is the Web version off the short docker bill Common that we have been using in previous section. Since it is the Web version, we have to use a court and version management service like get her orbit pocket, and finally, we have a list off options for our own profile, where we can do some customization, like adding more information about ourselves, changing passwords, getting some kind of help our most importantly the documentation. In next videos, we'll understand Dr Images with greater depth and work with them. 20. Understanding Docker Images: we have already studied and worked with Dr File. It's time to focus on docker images, as we have seen previously. A docker image is a collection or stack off layers, which are created from sequential instructions on a doctor filing. The layers are read only, although there is an exception off the top most layer, which is read, write type. But we will get into that later. The doctor images can be recognized either by their unique image i D, which is provided by DR or a convenient name or tag, which exploited by us, means users. Finally, they can be pushed or pulled from Docker Hub, which we just visited in the last demo. If we want to visualize the layers off a docker image, they would stack up like this. We start with the boot file system, which is pretty much similar to Lennox's own boot file system. It is an arrangement off See group name, spaces and resource, a location which virtually separates the image from rest of the files on the host or cloud . On top of that, we would help based image layer, which along with the layers about it, will follow the file mapping laid out by boot file system. Leah. Next, we have layers such as work directory, environmental variables. Ad copy exposed. CMD etcetera. Speaking off intermediate images. Here are a few points to remember. First of all, as we have mentioned earlier, intermediate images are created out off individual docker file instructions, and they act as layers off mean image or result in image. All of these intermediate images are read only. So once the image is built, these layers will not accept any change whatsoever. They have separate image idea off their own, which can be viewed using doctor history Command. If you're wondering, why does a doctor have existence off intermediate images in the first place? It is for cashing. For example, if you're building two different images from the same base image like Engine X and Apache on top off open toe, the base image layer will only be downloaded once and will be the used when it is the same . To make this cashing simpler, we have intermediate images where each layer has its own significant identity, and it separates itself from all other layers in terms off usability. But the intermediate images may not be used on their own, since they would not be sufficient to run a container process by themselves. For example, even the smallest image would consist off at least one base image, and one seem the entry point instruction. Finally, they're stacked as a loosely collective read only layer by a U. F. S, which is a union file system. 21. Demo: Working with Docker Images | Search, List, Push, Pull and Tag: First of all, we have Dr Search Command. It is used to search images from Docker home just to clarify, you don't need to have a doctor help account to search Reports from your host are even pulling them. It is just a requirement to use the Web interface off doctor, huh? Or for pushing repositories on it. As for the same tax off this command, the freeze doctor search is followed by the name off the image. An optional version number After Colon. Let's execute this command. Here we get a list off fightin images sorted by the number of stars. Of course, many off them are frameworks built on top of fightin. Since beytin would be one of the key words, there are description off images to provide more brief inside and a check off whether the image is official or not. Here, the first image has the most stars, and it is also the official image. Next, we have quite a special case. Doctors Search registry command gives official image off Docker registry from Dr Hub. If we don't want to get such a long list off repositories, we can also put filters on our search here we hope Put freely there is hyphen official equals True, which will only show us official images. There we go. We only got one image sweet, right for those who like their results need en tidy. Doctor also lets you format the results off the search. Here the format is mentioned in double inverted commas and it starts with the keyword table , which means we want a tabular format. Then we have entered the desired feels that we want. The fields are mentioned in double curly braces and they're separated by back slash D, which times for tab. What space character? You might have guessed by now that this will create three columns, one off each field. Now that the predictions and wish lists are done, there's under command. There we go, are crowded, little table is here and it is showing the same repositories as before. Just in visually different format. Also noticed that we only helped three fields that we had mentioned in the command and rest of the fields are skipped. Moving on from doctor search, we held Docker images command. It is a shorter version off docker images, a less common and both off them do exactly the same thing which is list out the images on your host. As you can see, these are the images that we built during our previous section. On the other hand, if we want to list out versions or instances off particular type of image, we can mention the image name followed by Docker Images Command. Let's try and list all our open toe images here. We can also see the size of the image, which denotes the size Dick currently occupy on the storage off host machine Off course specifying the version number preceded by a Kahlan narrows down the list just to one entry . Furthermore, if we want to see the full parts off truncated data like image I d. We can use hyphen, hyphen, no hyphen, trunk, flag as well. But be cautious while using it, since it can make the results messy, Really messy. Then we held docker. Pull it, Busta specified image from doctor huh Door knocker host. Here we have provided engine X with Colin latest attack. So which our image will have the latest tag on Docker hubs and the next repository will be pulled. As you can see, it has downloaded a newer version off Engine X, which is latest instead off latest. If we use engine X colon, Alpine doctor, Hubble provide an image with alpine tag. Now, if we grab a list off available engine X images on our host, we get too often. First is the Alpine one, which we just pull, and second is the latest version, as you can see both off them very majorly. In terms off size, Alpine is like minimal engine X image, which is smaller in terms of size, since Alpine as the basis itself is smaller. Finally, if we want all variants off engine X images, say, for testing purpose, we can hit the command with hyphen, hyphen, all tax flag, and we will receive the missing images from the repository once we list the engine X images . Now it is clearly visible that these are different versions but different sizes. We're back to our doctor Hub cash port. Let's click on create repository option so we can make a repo and push images to it on the left pane. Docker is generous enough to list up the steps to create a repo. First off, all were supposed to provide a name space for our repositories so that we don't have to make the name unique across the globe. Generally name space is same as the user name. Now let's name or repository. We're naming it. Report hyphen, Engine X. You can name it. Anything you like. Next step is the description off the people here. As you can see, we have given a short and sweet description about the city pool. If you want to describe your report in much more detail, you can jump to the full description section off this report. And in the final step, we can set the visibility permission for our report story. Dr. Offers one free private report An unlimited public report with free doctor have account. So do your choices wisely. We don't need private reports for now, so we will select the public visibility for this people. Now let's create the report by pressing create button at the end Off the page, we have successfully created our report Engine X, as we can see that there are some taps above the short description off the repo. 1st 1 is report in four tab. It displays the basic information about our repo engine X, such as it's visibility, which is public and short description about it. 2nd 1 is dags. You can add multiple images under a single people separated by different tags. If you do not specify any tack for the image it will buy before take latest attack. 3rd 1 is collaborators. It consists off a user or a list off user whom the owner off the private report wants to grant the read, write or admin access next, and the 4th 1 is Web Hooks. Web Hook is a http callback post request. It can be used to notify user services or other applications about the newly pushed image to the report. Last one is the settings off the repo here user can change the visibility permission off the report and can also delete the report from users. Talker help account permanently now. As you can see, you can pull the images available under the report Engine X repository. By using the specific docker, pull common doctor pull civilian canvas slash Report hyphen engine X and store them on your machines. Since this is your first ever repository created on Docker hub, let's self indulge ourselves by giving it a star. Starting the people is a way to show that you like the repository and you can remember it for your future references. Now let's switch back to the terminal before pushing an image to docker registry. We need to log in again to Dr Help using Docker Log in Command Interactive Lee Here we have been asked to enter our doctor Hub log in credentials. We will enter a user name, which is truly in canvas, and it's password we have successfully log in our account with a warning with says that our doctor have password is stored unencrypted in conflict dot Jason file on our machine for future references here. Okay, voted for now. So we will ignore the warning and proceed to the next step. Now we will attack a local image Engine X, Kahlan latest into a new image. We will specify where we want to push this image. We can write the host name on which the registry is hosting, which is civilian canvas for us. Now we'll mention the registry name in which we want to push the image that is repo hyphen Engine X. You want to give your own custom tacked to the image, such as CC hyphen engine X, for this example are If you don't mention any tag for the image, it will take latest by default. This two stage format is meditated to Bush, an image to a public repository. Now let's check out or newly tag image by listing all images on our machine. Dad, you are. We have original engine. Next latest image and newly tacked civilian canvas Slash Report. Hyphen, engine X Colin CC engine X image. But did you notice something? These two images have the same image I d. It is because Dr Tack Common has created an alias for your image as its new image name so that the original image will be untouched and all off its changes can be performed to the new earliest image. Now let's push the civilian canvas slash Report Hyphen Engine X Colin CC engine xto. Our report Engine X using docker push common. We have already specified the part for the destination location in image name. As we can see, Doctor is pushing each layer off the original latest image. Actus end. On the other hand, docker demon with stack all of the's layers sequentially and create a new image with the tag CC Engine X in the report Engine X At the end off the process, we got a new image digest. Identify off the push image. Now let's switch back to Dr Help account to verify that our report has been successfully pushed. Who will navigate to the report and the next repository Go toe tags and we have successfully pushed the image, Image tag, size and a belated name are mentioned here. In next lecture, we will dig deeper into the image by inspecting it and looking at its history. 22. Demo: Know your Docker Image | Inspect and History: as we know that Docker Images Command will list out all of the docker images stored in our machine with some basic information such as Image I D Repository, name and image Tak Tau Identify different images. But what if we want to know more about any particular image? Well, for that, we held doctor inspect command doctor, inspect common returns information about every single doctor object who has contributed in the creation off a particular docker image, which can be very useful at the time of debugging. Let's list out all of the open toe images available on our local machine. My writing command Dr Images Open to and we are. We have four open toe images with different image tags under open to repository. Let's inspect open toe Colin latest docker image type docker image. Inspect command followed by the image name that you want to inspect. We will type woman to Colin latest here, press enter, and as you can see, it has displayed the detail information about the latest woman to image in Jason Terry. Here we can see the extended image I D off open to latest followed by report, name and report. I chest which is the 64 digit hex number. Next, we help container identify. Don't confuse it with the containers running who want to image. It is the intermediate container which doctor has created while building the open toe image from docker. File. Container Conflict is the configuration details about the same intermediate container, which is stored as images. Meta leader for reference. Next is the information related to scratch image and its architecture, which is used as the base image here. It also mentions the actual and virtual size off the final image. And at last we have Root FS identify, which shows digest off all and immediately us off this image. If you want to access a specific detail about an image you conform at the output off. Doctor Inspect Common type Doctor Inspect, followed by the former tag Freud Arguments to format flag between inverted commas, report, tax and report. I just separated by Kahlan at last type docker image, name, press enter and as a result, we got the report back and report I just off woman to latest. We can also see of the inspect reserves, often image to a file in Jason format for future references here. We want to store the configuration details about this image in a text file. To do so. Type Docker image Inspect format followed by Jason Not conflict in double inverted commas and curly braces who want to and store the result In inspect underscore report underscore open toe dot txt file. It is just a name that we have given to the file. You can give any name which you want. List out all of the available files. Inspect report. Open toe has been successfully created. Let's check out the contents off this file. Conflict. Details about latest open toe image is available in the text file. If you remember root efforts, identify in the inspection off, open to latest image showed only that digest off all intermediate Leah's in the image based on only digests. It is difficult to determine how the image was built. For that we have darker history. Command Docker History will show us all the intermediate layers, often image. Let's find out the intermediate layers off this image type docker image History who went toe in terminal? We got all the intermediate Leah's for our latest open toe image. These layers are stacked sequence chili starting from the base image at the bottom to the CMD layer at the top. Off the results. All the layers have their associative image, ID's sizes and their creation. Time to dig deeper into this. Let us find history off one off the image which we have built on our local doctor host, who will find history off i. M g Underscore Apache Now type docker image history, followed by the image name, which is I am G Underscore Apache and press enter. You might be wondering why some off the rose off image column in both the reserves contained missing and some off them have their image. I ds. As you may remember, the intermediate image ideas are given to the layers created by DR Five Instructions, and they can be used for cashing purpose by our own Dr Host. But if a images pulled from Docker Hub, such cashing would not happen, and since it may cause environmental clashes, so we are not provided any image ideas for intermediate Leah's off pulled images, All we can know is they exist. We have two types off intermediate images which are easy to distinguish one which are built by some other doctor host, and we have just used it as base image and the ones which are committed by our instructions . You can also identified them by the time they were committed the base image immediately. US have 17 months old, whereas the other ones are committed just a few hours ago. 23. Demo: Clean up Docker Images: having unnecessary images lying around our host can be quite a border. Firstly, it consumes a lot off disk space and having multiple version off similar images can cause confusions nonetheless. Let's list out or available images. Just take a look. The list is already exhaustive. Time to narrow it down a bit to keep things neat and tidy. First, let's use our, um or remove command. We will remove an image with one hyphen alpine pull tag. As you may remember, these images were pulled as a stack off layered intermediate images, so they will also be removed. Similarly, all of the intermediate images along with the resulting image will be removed from our host just to verify. How did our command do? Let's get another list of images and we shouldn't find any image with one hyphen Alpine pull attack. Another way to write image RM is to simply write at M I and follow it by image i d. When views image I d. Instead of image tag, all images containing that I d will be removed here. One hyphen, alpine and Alpine variants off engine X image will be affected by this command On the other hand Such an operation involving I D off the image, which is used more than once, cannot be performed normally. That's why we're getting this error and the suggestion to remove them forcefully. Let's do so. We will use the same command with four stack as you may notice all of the images. With this, I d will be freed from their tag and they will be removed along with the intermediate images. 24. A Container is born!: we are done with both Docker file and Docker images, So now it is time to pay our much needed attention to extend the point off the scores. Cadenas We have already seen the formal definition off containers, but if we consider our updated knowledge, the simplest way to describe contain a would be are running instance off a docker image, you can compare it to the analogy off process and program In Lennar's, just like a process is a running instance. Off a program. A container is a running instance often image with help off name spaces on the Lennox. Host containers provide similar isolations. Like we, um, each container has its own file system, network driver, storage driver and administrative privileges as well. Despite off all of this, any container would be at least 100 times lighter than the Williams hosting the same set of Softwares we have seen previously that docker images are made off. Read only layers, and the top most layer is right herbal. Well, this top layer is roided. Do it while creating a container out off the image with correct network configurations. Containers can also talk to each other. Why I peace or DNS. It also follows copy on write policy to maintain the integrity off the docker image, which we will explore soon. You may wonder what exactly do we mean by running the image? Well, much less to the surprise run can be defined pretty simply. In our context, it means writing resource is like compute memory and storage. 25. Container Life-cycle: Ah, containers. Lifecycle s pretty much similar toe A processes life cycle in Lenox because after all, a container is just a running process. Instance off a doctor image. We start with the created states which can be a part off doctor run command or can be explicitly caused by Dr Create Command. If it is a part off run command, it will automatically lead to the next stage which is running state. It means that created container or the shed yule process is running and re sources are being actively used by it. Alternatively, if a container is explicitly in created stage, it can be sent to running state with start. Come on. Next is bossed stage which won't occur on its own. For the most part, you can strategically cause it with docker container Pause command and resume its similarly with a NPAs command to contain a process will goto pending states and once resumed, it will be back to being up and running. Next is stopped stage, which means the process off the container is terminated. But the container i d still exists so it can be re shield without creating another convenor and registering its I D. This can be due to multiple reason it can be caused by an era restart policy or simply container. Having finished its run to completion tasks, we can manually stop and restart containers with docker containers, stop and restart commands, respectively. Finally, we have deleted stage where the terminated container is removed and its i d is freed up. It will stop appealing in the list of containers to expand further on multiple containers from single image. Considered this Bagram, the read only Leah is common, and the read write layers are fetching data from it. This does not cause any data corruption. Since the data off read only layer is not going to be modified in the first place, and the system just has to perform multiple read operation on the same data. This optimizes storage off doctor host. Where is the number off running containers from the same or different image on a single host will always depend on hosts architecture limitations like memory and processing speed . Another important aspect of containers is their copy on write mechanism. What's that? Well, it's pretty simple deal. Now we have seen that credible layer off container is mounted to the read rightly off Docker image. Well, that was true, but it has a little secret to it to read. Only layers filed themselves are untouched. Ah, copy off them is created and read rightly is mounted on that copy, which makes it easier to recover the layers in case any unauthorized host file system access or condom damage. 26. Demo: Container Run Vs Create: Let's test out both of these commands with a busy box container. First, we will use docker container. Create command. It is followed by hyphen I D tag, which means it will be interactive and teletype enabled. We haven't given it detached flag since we don't need toe, we're naming or container cc hyphen. Busy box A and we're using image busy box with latest attack when we run the command. Since the content off the image is not available locally, it will be pulled from the doctor hub once it is pulled. What you see at the end is the unique container I d created by Dr. The idea is unique at least across the host and cluster. If you're running any now or container should be created to list Argentina's, we have to run the command docker ps hyphen A And once we do so we get a list off. All the containers which are running are about to run on have finished running on this Horst. The output layer is fairly simple and the top most entry is our recently created container . It is not in the running state yet, which can also be verified from the Status column. It is followed by quite a few other containers which have finished running and have exited some time ago. Here the resources are already ready to be allotted to the container, but haven't been allotted yet. Don't worry. We'll let this container enjoy its dream run as well. But before that, let's see what happens when we run a container. Instead, you might find this command similar to what we have used in some of our initial demos. It is because this is the most to mainstream way to run it this time. We also put that the flag so we don't have to dive into the container. And we have named it cc busy box B. Since we had already pulled the busy box image last time, Doctor has cashed entirety off it and has simply returned a container. I d If you're wondering, why do we have an R M flag tagging along? It instructs Docker to delete this convener after it has finished running. Let's check out Dr P s hyphen e again and what we see is our top entry replaced by busy box be container. Unlike its counterpart called busy box A This one is earning for six seconds. In fact, there is also a three second difference between its creation time and just running time. You can assume that doctor took that time to allocate the resources and register it as a process to its host. Since we have our containers running, we'll play with it a bit more in the next lecture. 27. Demo: Working with Containers | Start, Stop, Restart and Rename: Let's start over Demo, where we have ended the previous one. The list off containers is still the same just the time duration has updated. In previous demo, we had created the container called CC Busy box A, but we did not run it now to send it into running state. Let's use Docker container Start Command, followed by the name of two container. We don't have to provide flags like ideally, since they have already been passed during the create command. Let's run it. We won't even get a container. I d here. Since that two had been generated previously, all we will get is the name off the container as a nod to success off the command in typical doctor See lifestyle. Time to get repetitive and list out the containers again using docker PS hyphen A. And we haven't update are created. Container cc Busy box A is now finally in running state, just like start. We also have a command to stop the containers. Since a has just started running, let's stop cc busy box B again. Ah, confirmation signal is the name of the container, and if you want to verify it, let's list our conveners again and wait, where is RCC? Busy box beat? Does that mean that isn't ETA? Well, no. If you remember, we had applied. Aflac called Adam in our last demo with Docker run common on Sisi Busy Box Beacon Dana, which meant that the container will be deleted once in once it has stopped running. To use this simple. If you want to reuse the container, keep it. If you don't want to use it, remove it and free up somebody. Sources. Next we held a restart command. Let's restart our CC busy box, a container. We'll also give it a buffer of five seconds. And when we verify it, what we get is a freshly started container up and running. Finally, I think all of us would agree that Sisi busy Box A was not that great off a naming convention to follow. It's just Lindy or complicated and bland. If you encounter such thoughts with Jurgen Deena's, we have a command to rename them. Let's be a bit more casual and rename cc hyphen, busy box hyphen A as my hyphen busy box, and when we list them, we can see the change is reflected by the way notice that the container has just been renamed, not restarted, which means we can rename them almost whenever we want unless they affect some other containers. In next lecture, we will do something more application related with our containers. 28. Demo: Working with Containers | Attach and Exec: just like previous demos. We have a list of container here Now let's use docker container attached command. It means that we are attaching the standard Io and standard error off or container to the terminal off our doctor client. We have attached my busy box container here, so let's hit enter. As you can see now we are accessing standard. I owe a terminal off busy box from our open to terminal. If we hit a less, we will see a list of available directories in busy box route environment. We can play around a bit more to navigate to other directors as well. If we exit it written back door open to host terminal and there is an interesting aspect to the attached command. When we list the containers again, we can see that my busy box container is not running. It has exited a few seconds ago. In other words, attaching the container conditions it to be stopped when we exit the attachment. An alternative to this is Dr Executor meant it allows us to use any command we want and it executes two container. But before let's start our container again. Now we have used Doctor exact, which stands for Execute with hyphen i d. Flag on how directed it to run and print the result off PWD Command. Once it succeeds, we held a forward slash, which indicates route off our busy box. Unlike attach. If we list the containers again, we'll find or containers still up and running. 29. Demo: Inspect and Commit Container: it is time to know our containers in greater depth. First, we have the list of containers just to avoid any confusion. We have run an open toe container after the context off. Last demo. Let's get more information about it with Doctor Inspect Command followed by the container name. What we get as output is the Jason description off the container. We don't need to be intimidated by the sheer amount of information as well. Interpret them one by one. Starting from the top, we have container I d provided by Docker Timestamp off container creation part where the container is running. No arguments since we haven't provided any in the state backing off the container. We have indications off the fact that over container is in running state and not paused or restarting our debt, then it has not been killed by going out off memory. It's process I d on you. Bento is 6 94 Then we have information about the image in Terms Off Image Digest and we have various parts such as host, part log, part and configuration part. Then we have another bunch of information where most off it is irrelevant to this particular container so they're either null are empty. But which do matter are the name off the container and the fact that it has not restarted yet. Following this? We also have network volume and other information which might be useful to you once we proceed further in this course. For now, we can focus on finding specific information from the Inspect Command. Since even if you get completely familiar with all the attributes, reading them every time can be really daunting. Let's use format flag with her, inspect command and narrow around the results to just i p address. We can do this by narrowing the range to networks and under network settings. Choosing the I P address field. There we go. We have the I P address off our container. Next is the Summit Command. To effectively use that command, we need to make at least one change to the container state after it is created from the image. Just to remind you, this urban two container is created from the same image that we had pushed on our doctor Hub Repo. Let's execute it with bash. You should already be used to this command by now. Let's verified by listing or the directories. Yes, we are in the container. Now Let's run an update. The purpose here is just to change the state off. Contain A from men. It was created once the A plate is complete. Let's exit it now let's use Dr Commit Command, followed by the container name, which is my open to and update name in the format Off Doctor Hump People images. We have kept it as updated Cuban to 1.0. Once we entered it, the oblate will be committed to our doctor Hungry people. As you may have guessed, it is essential for us to be loved into our doctor. Have account to use this demo. The updated container is committed as the image as it's read, write lier turns read only and is stacked on top of previously us off the former image. So instead of containers, if we list out the images, we can find the updated one, which can be directly then as a container, and we won't have to read under a great command. This helps maintaining diversions off docker images. In next lecture, who will learn about port mapping 30. Demo: Container Exposure | Container Port-mapping: in this demo will map our host machines sport to contain a port. The command is fairly simple, as we just have to extend the run command with a flag. We'll map our hosts. Port 80802 Container Sport 80 on TCP by mentioning it following hyphen. B notice that the imagery used here is the one that we had created while working with exposed instruction. Now, when we run the containers, we'll get the ports mentioned in the airport. The output looks a bit messy, but the annotations should help here. Now we'll create another grand dinner from the same image called con engine X hyphen. A. Instead of providing ports and protocols like earlier this time, will just provide capital hyphen p and allow docker to map ports by itself. Here it will use the information provided by exposed instruction in the docker file and tally available pours from host machines network drivers. We can see that the new container has port 80 mapped from container to port, 32,768 off host. We can also view this information by hitting Docker Container Port Command, followed by the container name. Finally, when we learned local host on Port 8080 on our Web browser, we can see Engine Ex home page, which indicates that our port mapping was successful. When we do the same with the other container, it shows the same thing as well. In next lecture will clean up or workspace. 31. Demo: Container clean-up | Prune and Remove: So in this demo we will learn different ways of removing the containers. Let's list out all off the organ donors. And, yes, there are quite a lot off them. In fact, many off them are not even that's significant at the moment and should be removed first. We held a basic Adam Command, followed by a containers name. Here we have preferred a stopped container. Kant underscore from once. It is a mood it will disappear from the list. Then we have the same Adam Command. But instead of providing name, we have provided the container I DS off the stop containers, and the result is the same. They disappear from the list after being removed. The case will be a bit different with the running containers. Just to make sure that we are not making any mistakes while the leading running container it asks us to provide the forced demolition flag, I would say it is a kind gesture, since it avoids potential unforced errors. As we add the forced flag, nothing can stop us from removing it. If we want to be kind to contain us and want to kill them properly, we can send the sick dome signal using docker container Kill command. But as you can see, we still have quite a few containers turning and we don't need to stop ones for the most part, to remove the stop containers, we have a command car docker container Prune. It is a short and sweet common and doesn't require any names. Our i ds. It will simply kill all of the dangling containers and free up whatever resource is it can . We had three off such containers which got removed, and we got 1.8 megabytes off free space. Finally, our list off containers only contained the lie ones in next model will go deeper into networking. 32. Multi-container Applications and Introduction to Networking in Docker: till now we have played with single containers in are Yours. But even if we did use more than one containers, they were completely independent off each other. For example, one container might be enough to host a static landing page, but a smartphone app would definitely require more than one containers, but each of them may self specific purpose. In such a case, information exchange between containers become a crucial factor off overall performance off the application. In other words, they need to talk. The communication can be 1 to 11 too many or many to many. In case of docker containers, These communications are managed by objects called network drivers to define them simply a doctor Network driver is a piece off software which handles container networking. They can be created simply using DOCKER Network Command. No images or files are required. Speaking off networks these networks can spawn from single host instances to multi host clusters. For now, we'll focus on single host and we will visit cluster networking and we deal with Docker Swarm. Dr. Network drivers are quite reliable, since DACA itself uses them to communicate with other containers and outside world. This also means that Dr itself provides some native network drivers. If we don't want the water creating ones by ourselves as a trade off, it means less control or I p ranges and ports, apart from the networks we create and the default ones. Doctor also supports remote network drivers, which are developed by third party and can be installed as plug ins, although they are still quite under growing states. And mostly they're useful for specific use cases like enabling networking on a certain cloud provider apart from network drivers. Doctor also Floyd's I. Pam R. I. P. And Tress Management Driver, which handles I P address ranges and distributions if they are not specified by the admin. I know you have loads of questions like, How do these networks work? Are there any types? Is there any structure which they follow? Well, we will explore all of the's details in next lectures when we study container networking model and types of doctor networks 33. Container Networking Model (CNM) of Docker: Let's dig deep into container networking model. First of all, we have host network infrastructure. This include both software and hardware infrastructure details like using Eternity or WiFi and host oils. Colonel and Work Stack in our case, Lennox Network Stack. On top of that, we have Dr networking drivers, which include Network and I Pam drivers. We just recently stated that functionality briefly in last structure. On top of these drivers, we held docker engine, which creates individual network objects, as you might have guessed user defined on before containing metal objects fall on top off docker engine. Since their provision by it, these blocks are a part of DR itself. On top of for container network, we held running containers which are accompanied by at least one endpoint. I said at least one because it is normal for container to help connected to two or more networks and hence consisting off Morton. One endpoints speaking off endpoints. Their container side connected representation off virtual Internet, which is the common protocol for networking across darker. They contain networking information such as I P address, virtual physical Andress and ports, as mentioned earlier. If a container is connected to more than one networks. It will have more than one corresponding endpoints, which will contain different I P's. The scope off these I peas would typically be limited to the host in case off single host implementation within the same scope. If two containers are connected to the same network, they can also communicate wire. DNS were container names can be used instead of I P's container networks. Ploy this information to network and I, Pam drivers, then network and IBM drivers translate these requests into host network supported packets and transmit them to make sure containers can communicate to the outside world. Because if that doesn't happen, forget engine X. You wouldn't even be able to execute after get update command properly. So this is how container network model works. In next lecture, we will look at network driver types in detail. 34. Docker's Native Network Drivers: out off NATO and remote network drivers were going toe work on native drivers. Native docket BET. Truck drivers are used in creation, off default on user defined networks. Do you remember this diagram from previous lecture? Let's shrink it a bit for the convenience now that's considered the first type of network the host network. The idea is pretty vanilla here. Network credentials off the host are directly reflected on the container and point, which means containers connected to this network will help the same i p as the host itself . This doesn't mean that container with abandon, their true nature toe getting a bit more practical. Let's say we helped to containers connected to the default or user defined host network. In this case, both containers will communicate where virtual Internet, reflecting the capabilities and limitations off the host machine. Moving on from host, we helped bridge network. It is also the deformed network for docker containers. If we don't explicitly connect or containers to any network, they will be connected to the Default bridge network. The name off this network helps a lot in defining its properties. It creates a virtual eternity bridge all of the containers connected to this network are connected to this bridge, where container and points the bridge communicates to the host network. It means that the containers will be isolated from host network specifications. Containers will have different eyepiece than host. We can define the I P Range and submit mosque for the bridge and subsequent networks. But if we choose to opt out from this decision, I Pam drivers managed this task for us. We can think our address these containers using the I p exploited by the virtual bridge. Off course. The communication will pass through the host machines Network means if it is down, but it won't be able to do much amounted. But this can help us hiding the DNS or i p off the host in recent version off Docker E 17 and about. We can also use container names toe addis them when we're communicating within the same doctor, Bridge network will practically explore these networks more in dem electors. Further, we have overlay networks in case off all a network. We do need to come out of the cocoon off single host locker infrastructure in industrial usage off docker community, our Enterprise edition. You will most likely find cluster or clusters off docker host, which will run single, connected, or at least the relevant set of containerized applications. Such an arrangement is called Swarm, Moored in Docker. Swarm heavily relies on oil in a truck provisioning off darker. We're yet took over swarm in our course. But do not worry. This explanation will not flood you with unknown form terminologies in case off bridge network. All we had to worry about was containers I P. Since we had only one host. But with all the network will have multiple host having multiple containers where any combination off communication might be necessary. So while establishing or performing container to container communication, our network driver can't get away by just keeping track off containers. I p. It also needs to shout its communication to the proper host. To solve this overlay network will help two layers off information underlay network information which will contain data regarding source and destination off horse. I'd be and overly information Lear, which will contain data about source and destination containers. I p. As a result, the communication packet header will consist off. I p addresses off both source and destination hosts and containers. If you look into it practically when we introduce warm 35. Demo: Create Docker Networks: in this demo, we will create our first Doctor network and understand it. We will do it by using doctor network, create command and furnish it with driver flag. Our driver for this demo is a bridge network. So we will pass the argument bridge and finally we'll give it a suitable name. My bridge. What we get as a result is an i d for the network object which has been created. Now before we dig deep into my bridge, let's create another network called my Bridge. One will provide a few more perimeters with this one for better compassion. Apart from the previously provided flag driver on its Value bridge, we have also provided the sub net and I'd be range again. We received another I D. Let's list these networks out. As you can see, my bridge and my bridge one are not the only available networks on the list. That is because Dr Roy's us A. Set off default, created networks using different network drivers hit the our bridge host and none you can tell by the names that bridge and host are using corresponding network drivers. None is a special case toe. It is used to indicate your isolation and lack of connectivity. We can also filter the search by providing the filter tag. Let's put the filter that we only desire bridge network so the driver field will be said to bridge and here we have all the networks created with bridge network driver. 36. Demo: Working with Docker Networks | Connect, Disconnect, Inspect & Clean: In this demo, we will connect one off or containers with one off the networks that we have created. First of all, let's see if we have any running containers. The container should be interning state, since network object connectivity in Docker follows the rules off inter process communication in Lenox, which means if there is no process, nothing can talk to it in terms off networks. As we can see, we have to off our spare containers from previous model, but both off them on an exit state. Let's start my Cuban to contain a Now keep a list off networks in front off us to make better decisions. We will use Docker Network Connect Command, followed by network name and container name and hit Enter. We don't get any sort off response like network I D or container I d. From Docker. So a fair way to verify the connection would be to use talker. Inspect command after using inspect on my open to If you navigate to the networking fields off the output, you can see that we have description off bridge network, my bridge one attached to my open toe container. And it also has the alias, which is same as the one we had received after creation off tat bridge network. You can also notice the end point, which is described with an endpoint i d and the one next. Come on. Instead, off using a separate command to connect the Doctor Network. You will mention it along with the Run command using network flag. Here we are providing host network to the container name Kant. Underscore Engine X, which will be created from engine next image. Having the latest tag, notably if you run Docker Container Port Command with corn underscore engine X. You won't receive the port mapping information since no port mapping takes place with host network driver container communicates to Internet using port off host itself We can you more information about this horse network using inspect command on container. And as you can see, we can get network I D and endpoint details off the host network instance. Just like in previous container Here, too, you can notice a field named bridge under network settings. This field is empty. The reason is, if we do not provide any network manually, Dr Price, the default president, work to every container. No Let's inspect the default bridge network. It seems that it, too, has its end point. Submit, and I'd address range. Now, if we look at the containers field, we will find my open toe or, to be precise, only my open toe. The reason why corn underscore Engine X is not listed here is that it is connected to the host network, Dr The Next a container toe, one off the D Ford networks. And mostly the priority is bridge. Unless we mentioned otherwise. Explicitly, not the I P address off my open toe under D for Bridge Network, which is 172.17 dot zero dot to. Now let's inspect user defined bridge network in our case, my Bridge one network. It has similar parameters compared to default bridge. Apart from different endpoint, I be Range and I ds. It also has my open toe container connected to it. But the I P is different from the default bridge. In other words, my open toe container can be accessed from both the networks using corresponding eyepiece. We can also format the output off, inspect command like we used to do it. Previously, let's grab the value off scope field off the Fort Bridge network are we can grab a set off i D and name for the same as it is visible in the output. The first entry is the network I D. And the 2nd 1 followed by a Kahlan, is the network name. Now let's list are containers again to see what to do next. Well, we can see what happens when we disconnect a network from Container. Let's use Doctor Network Disconnect Command, followed by network name and container name, which are my bridge one and my open toe. In this case. Finally, if we inspect our network, we can see that container My open toe, which was previously mentioned. There is successfully out of sight. Similarly, if we inspect the container, we won't find the user defined network eater. 37. Demo: Ping one Container from another: in this demo, we will finally see the results off our doctor. Networking Hustle. Starting off, Let's follow our standard practice off. Getting a list off. Doctor networks were quite clean. All we have our default host bridge and neural networks not discreet. A bridge network called Net Bridge and provided sub Net and I p. Ranges as mentioned in the command. One status done. Run a container called Kant underscored database from Reedus Image and connect it to Net British network. That's fetch its I p. Since we will be using it later in this demo i p off This container is 172.0 dot to 40 Talk one. Let's on another container from busy box image and call It's over. A. This one is also connected to net president work just like previous one. Now let's inspect own Net Bridge Network to find which containers are connected to it. There we go. Both corn database and silver A are connected just as we had expected for the more so is I . P is 172.20 to 40 dot to following the range which we had provided Run the third container also from the busy box image and call it server. Be notice that we have not mentioned any network whatsoever, which means it will be connected to the default bridge network. We can also verify it by inspecting its network information. And while we're at it, let's not its I P as well, which is 172.17 dot 0.3. Now let's switch to view a little. We help three terminals, which will be using for three different containers. If you don't want to go through all the trouble, you can use multiple terminals and keep on switching between them or can run them on multiple displays. However you feel comfortable. Let's execute gone database container with Bash common. Once we have navigated to the route off the container, let's start toe Ping Google. Oops! It seems like thing is not installed in the base image off readers. So let's go ahead and fix that. Ran a generic update and install Ping I P utility with this command. And once the installation is complete, next resume where we had passed the flow off this tutorial being Google. I love saying this being Google bing Google. There should be enough. That's block it with control, See? And what we see is successful being with no packet loss. Now, if you remember, we have noted the I p off all of the containers server is I be was 172.20 to 40 dot to Let's being that it was a success. It means to off all containers. Just talk to each other without any sort of packet loss. Since they're connected to the same bridge network, this communication was more or less I PC or inter process communication within the Lennox host. But considering the isolation they have opened, it can be treated like two ends. Often, application were communicating. Going further. Let's go on another terminal and execute server taken Dana Thing, Google and Cont database container from it. Both of them will be successful, since Bridge Network allows containers to communicate to external world using virtual Internet and containers connected to the same network can talk to each other using their endpoints. Lastly, let's run so RB container, which is connected to default. Prison network, not user defined. Net bridge one. If we try to open Google, it is a success. But if we try to make other containers, we would fail, since they are not connected to the default bridge at the moment. On the other hand, even if we use DNS names off the containers instead, off their eyepiece, containers connected to the same network will face notable swell pinging each other at all . This explains and demonstrates capacities and limitations off Origen it works. 38. Never lose a "bit" of your data!: - From 1/3 person's point of view, this may seem like a funny story, but it can potentially cost you your job. That's the prime reason why we need efficient stores solutions with containers. The logic is pretty simple. Containers data needs to be backed up somewhere as a permanent storage. And a quick question that will come up in your mind would be what on which details should be backed up. To answer that, we need to look back at the layered structure off docker image and container data. If you remember, we helped to types off layers, laid only layers, which hold permanent data and is never modified. Utopian right policy and read write layers, which hold temporary or wallet. I'll data if a container stops or dies the wallet. I'll day now vanishes. So now we have our answer. We need to back up the important data from the wallet. I'll read right lier off the container. Now. The next question is where to store the data? Well, just anywhere. Do you want to store it on some machine, which hosts Doctor? Go ahead. Do you want to store it to another server? Go ahead. Do you want to store it on a cloud, go ahead as well. And the last n genuine question Which comes to my mind. Is there any type off storage objects? Yes, there are most commonly used. College object type is called a docker volume in a volume. The container storage is completely isolated from the host file system, although the data off volume is sorted in a specific directory off the host, their controlled and managed by talker command line. Compared to other options off storage, which we will visit soon enough, vol