Ravindra BagaleCourses & study guides मराठी

Ravi Sir's Cards › DevOps

Chapter 6: Why Docker, Images and How a Container Is Created: Cards

मराठी cards · Open the chapter

Revision cards

Why not install the app straight on the server. Apps installed directly on a server fight over versions and differ between machines.
Revision card 1 of 12: Why not install the app straight on the server · Download PNG · Open card page

Lesson: 6.1 Why the app should not be installed straight on the EC2

One image, and what a container is not. Beginners think containers are small VMs and lose data inside them.
Revision card 2 of 12: One image, and what a container is not · Download PNG · Open card page

Lesson: 6.2 One image, and what a container is not

Image vs container. These two words are mixed up in almost every beginner question.
Revision card 3 of 12: Image vs container · Download PNG · Open card page

Lesson: 6.3 Image vs container

Way 1: docker run an existing image. The fastest way to run software is an image someone already built.
Revision card 4 of 12: Way 1: docker run an existing image · Download PNG · Open card page

Lesson: 6.4 Way 1 — docker run an image that already exists

Way 2: docker build from a Dockerfile. Your own app needs its own image.
Revision card 5 of 12: Way 2: docker build from a Dockerfile · Download PNG · Open card page

Lesson: 6.5 Way 2 — docker build from a Dockerfile, then run

Way 3: docker compose up. Real apps need several containers started together.
Revision card 6 of 12: Way 3: docker compose up · Download PNG · Open card page

Lesson: 6.6 Way 3 — docker compose up (pointer)

Way 4: docker commit (emergency only). Changing a running container and saving it hides how it was made.
Revision card 7 of 12: Way 4: docker commit (emergency only) · Download PNG · Open card page

Lesson: 6.7 Way 4 — docker commit, emergency only

Nginx, PHP and MySQL: three containers, three jobs. Putting everything in one container makes it hard to update or scale.
Revision card 8 of 12: Nginx, PHP and MySQL: three containers, three jobs · Download PNG · Open card page

Lesson: 6.8 nginx, PHP and MySQL — three containers, three jobs

docker history: read the layers. Big images are slow to pull and carry more security holes.
Revision card 9 of 12: docker history: read the layers · Download PNG · Open card page

Lesson: 6.9 docker history — read the layers

Make the image safer. Default images often run as root and include tools attackers can use.
Revision card 10 of 12: Make the image safer · Download PNG · Open card page

Lesson: 6.10 Make the image safer

Push to Docker Hub and pull elsewhere. Images must move from your laptop to servers.
Revision card 11 of 12: Push to Docker Hub and pull elsewhere · Download PNG · Open card page

Lesson: 6.11 Push to Docker Hub and pull on another machine

Lab: one image, three names. Tags confuse beginners until they see one image with many names.
Revision card 12 of 12: Lab: one image, three names · Download PNG · Open card page

Lesson: 6.12 Lab — one image, three names

Interview cards

Why use containers instead of installing apps on the server? Containers give each app its own libraries and versions, and the same image runs the same everywhere.
Interview card 1 of 12: Why use containers instead of installing apps on the server? · Download PNG · Open card page

Lesson: 6.1 Why the app should not be installed straight on the EC2

Is a container a virtual machine? No. A container is an isolated process sharing the host kernel. A VM has its own full OS.
Interview card 2 of 12: Is a container a virtual machine? · Download PNG · Open card page

Lesson: 6.2 One image, and what a container is not

What is the difference between an image and a container? Image: read-only package. Container: a running copy with a small writable layer.
Interview card 3 of 12: What is the difference between an image and a container? · Download PNG · Open card page

Lesson: 6.3 Image vs container

What does docker run -d -p 8080:80 nginx do? Starts nginx in the background and maps host port 8080 to container port 80.
Interview card 4 of 12: What does docker run -d -p 8080:80 nginx do? · Download PNG · Open card page

Lesson: 6.4 Way 1 — docker run an image that already exists

Walk through a simple Dockerfile. FROM base, WORKDIR, COPY files, RUN install, CMD start command.
Interview card 5 of 12: Walk through a simple Dockerfile. · Download PNG · Open card page

Lesson: 6.5 Way 2 — docker build from a Dockerfile, then run

When do you use docker compose? When an app needs several containers (web, DB, cache) started together on one machine.
Interview card 6 of 12: When do you use docker compose? · Download PNG · Open card page

Lesson: 6.6 Way 3 — docker compose up (pointer)

Why avoid docker commit? It saves a hand-changed container, with no record of the steps. Nobody can rebuild or review it.
Interview card 7 of 12: Why avoid docker commit? · Download PNG · Open card page

Lesson: 6.7 Way 4 — docker commit, emergency only

Why one process per container? Each part can be updated, scaled and restarted alone, and logs stay clear.
Interview card 8 of 12: Why one process per container? · Download PNG · Open card page

Lesson: 6.8 nginx, PHP and MySQL — three containers, three jobs

How do you find why an image is big? Run docker history to see each layer's size, then fix the biggest step.
Interview card 9 of 12: How do you find why an image is big? · Download PNG · Open card page

Lesson: 6.9 docker history — read the layers

How do you make a Docker image safer? Small base, run as a non-root USER, no secrets inside, .dockerignore, and scan it.
Interview card 10 of 12: How do you make a Docker image safer? · Download PNG · Open card page

Lesson: 6.10 Make the image safer

How do you share an image with another server? Tag it with your registry name, login, push; on the other server, pull.
Interview card 11 of 12: How do you share an image with another server? · Download PNG · Open card page

Lesson: 6.11 Push to Docker Hub and pull on another machine

Can one image have many tags? Yes. A tag is a name pointing to an image ID. Many names can point to one image.
Interview card 12 of 12: Can one image have many tags? · Download PNG · Open card page

Lesson: 6.12 Lab — one image, three names

Comparison cards

Docker image vs Docker container. Docker packs an app with everything it needs so it runs the same everywhere.Image: a read-only package (app + libraries + settings). Like a recipe.Container: a running copy of an image. Like the dish cooked from that recipe.
Comparison card 1 of 3: Docker image vs Docker container · Download PNG · Open card page

Lesson: 6.3 Image vs container

Container vs Virtual Machine. Container: isolated process sharing the host kernel.VM: full computer with its own OS on a hypervisor.
Comparison card 2 of 3: Container vs Virtual Machine · Download PNG · Open card page

Lesson: 6.2 One image, and what a container is not

Dockerfile vs docker commit. Dockerfile: written steps to build an image.docker commit: snapshot of a changed container.
Comparison card 3 of 3: Dockerfile vs docker commit · Download PNG · Open card page

Lesson: 6.7 Way 4 — docker commit, emergency only