JayCesar / cloud

0 stars 0 forks source link

🐋 Docker Crash Course #3

Open JayCesar opened 3 months ago

JayCesar commented 3 months ago

Overview

image

JayCesar commented 3 months ago

What is Docker?

Why is this a big deal?

Development process before containers

image image image image

Development process with containers

So how container solve theses problems?

image

So I can focus more on development!


image

image

image

Solution: image

JayCesar commented 3 months ago

Virtual Machine vs Docker

How an OS is made up?

There are two main layers (SO and Kernel). Kernel talks to Hardware and SO are the applications. Linux Applications talk to the Linux kernel and Windows applications talk to the WIndoes kernel

image image

Docker

VM

It virtualizes the complete operating system and boots up its host. image image

Docker images are smaller than VM images image image image

Important note: Docker works only with Linux Distro while VM with all OS's. This is the main difference between Docker and VM (Compatibility).

It means I can not run Linux bases images over Windows kernel, because I can not run Linux application layer in Windows kernel.

But later on, running Linux images in windows became possible but only using docker desktop. (Hypervison layer).

image

JayCesar commented 3 months ago

Install docker

image

Docker Desktop

image image

JayCesar commented 2 months ago

What are images?

image

An executable artifact in software development and deployment (including Docker) is a file or set of files** that can be directly run or executed to perform a specific task or start an application.

And when I run this image, I mean, this executable application artifact, I have a running instance of this image, which is called Container. Run an image? I create a container.

image

So, I can run multiple containers from 1 single image:

image

JayCesar commented 2 months ago

docker images = list docker images docker ps = list docker containers

JayCesar commented 2 months ago

Docker Registry

How do we get images? Using docker registries: image image image

Docker Hub is where I find images from a lot of services!

image image

So images are versionated!

JayCesar commented 2 months ago

DockerHub Registry is the default location when I try to pull an image.

If I do not specify the tag, It will download the latest by default too.

JayCesar commented 2 months ago

Run an Image

I can run an image by using these command:

docker run {image}:{tag}

Then a container (with a random name) will be launched, but I will be 'inside' the container. So to exit I just run the command "exit"

I can run the command in background using "d" of "detach":

docker run -d {image}:{tag}

to see the logs:

docker logs {container}

Obs: I can run the images without running the command docker pull image