Steps

Docker 101 - Introduction Overview for Beginners

Step1 of 7

Container vs Virtual Machine

Docker is a greate tool to do container more easier than before. But what is a container ? Why use this ?

Container vs Virtual Machine

Virtual Machine has a guest OS with all bin, libs and stuff provides by Linux distribution (some linux distributions : CentOS, RedHat, Ubuntu, Fedora, Alpine, ...).
It isolates vCPU / RAM guaranteed or shared to the virtual machine and do some isolation between the others virtuals machines on the host (a.k.a. VMWARE).

The minimum recommanded disk for CentOS is about 10 GB.
The difficulty is when you have to migrate your development to production. You can't deploy a snapshot of your VM because your Dev environment isn't the same about your PROD.

Containers were born long before Docker but Docker give simple way and shorts commands to instantiate an isolation of process running inside the Container.
Isolations are based on cgroup, Kernel capabilities, ...

Container are lighter than VM (CentOS is about 200 MB).

A container is an instantiation of an immutable image (deep explaination in a futur scenario). So Dev environment could easily send in Prod and both ar iso

You know understand, that container process are shared ressources on host, but container offer an isolation. But process are mirrored on host and segmentation doest include kernel isolation by default.

PID 1 in container is mirror from PID of the process on the host.

Container Logs

Task 4 (1/2)

Clean

Delete all containers

In Terminal 1

docker container rm -f $(docker container ls -aq)

List your container :

In Terminal 1

docker container ls -a

clear

In Terminal 2

clear

In Terminal 3

clear

Introducion

By default, Docker records all stdout and stderr events on tty and then in JSON for the host (by default /var/lib/docker/containers/CONTAINER_ID/CONTAINER_ID-json.log).

You can generate events for your application, but you cannot distinguish ERR from STDOUT the error without tagging on your part.

Debugging Scenarios

Help

Katacoda offerings an Interactive Learning Environment for Developers. This course uses a command line and a pre-configured sandboxed environment for you to use. Below are useful commands when working with the environment.

cd <directory>

Change directory

ls

List directory

echo 'contents' > <file>

Write contents to a file

cat <file>

Output contents of file

Vim

In the case of certain exercises you will be required to edit files or text. The best approach is with Vim. Vim has two different modes, one for entering commands (Command Mode) and the other for entering text (Insert Mode). You need to switch between these two modes based on what you want to do. The basic commands are: