Sunday, February 12, 2023

Dockers and containers

What is docker?

Docker is an environment with its own OS+ user space (related packages & modules) that resides on a bare-metal system and uses system HW/Kernel resources to serve a different purpose.


We must understand 3 environments (Bare metal,  Docker, virtualization)

·        Bare metal is one kind of environment where we test our GPUs directly

·        Docker is one kind of environment that is separated from Bare metal.

       Virtualization is software, that makes computing environments independent of physical infrastructure. In contrast, cloud computing is a service that delivers shared computing resources (software and/or data) on demand via the Internet.

·        If you launch Docker, it has its own user space with all dependent packages and its own OS.

The beauty of the docker concept :


   Docker is platform-independent and can run on any machine regardless of the operating system present.


      Docker is controlled by a kernel space.

·        Kernel sitting very close to the hardware.                                                 

·        If Kernel space/Firmware is broken/crashed, we can’t do anything.

·        Both Bare-metal and Docker have the packages, Except Docker does not have kernel space. Docker will use kernel space which is available on the bare metal.

Docker architecture components & How does docker work? 

Docker architecture comprises 3 main components

1. Docker Client: This is the interface through which users interact. It communicates with the docker daemon.

2. Docker Host: Here, Docker daemon listens for docker API requests and manages various docker objects, including images, containers, networks, and volumes

3. Docker Registry: This is where Docker images are stored. Docker hub, for instance, is a widely used public registry 

          Docker & container related commands

sudo docker pull <docker_name_based_on_OS> cmd will pull the specific doker into the machine

sudo docker images  ==> cmd will list the available dockers in the present machine

sudo docker rmi  -f  docker_id ==> cmd will delete a single specific docker in the present machine

sudo docker rmi  -f  docker_id_1 docker_id_2 docker_id_3 ==> Will delete multiple dockers

sudo docker ps -a ==> cmd will list the available containers in the present machine

sudo docker rm container_id ==>cmd will delete a single specific container present in the machine

sudo docker rm container_id_1 container_id_2 container_id_3 ==> will delete multiple containers

docker system prune -a   ==> It will clear space on your device by doing the following tasks 

     This command will remove: 

            - all stopped containers

            - all networks not used by at least one container

            - all images without at least one container associated with them

            - all build cache


Ø   sudo dmesg: dmesg contains all kernel-related information (loading /unloading, module loading firmware loading. etc. lot of information).

Ø  sudo dmesg | grep -i error if you search like this it will give kernel/firmware-related error messages 

Ø  Any kernel-related error & other information you want to see then you must run sudo dmesg from the home directory,

su sudo dmesg -C  --> It will clear all kernel error messages

Ø  cd /var/log/ èin this folder the dmesg log file & other kernel log files are present.

èFirmware not loaded/ kernel crashed all information, You can use the command sudo dmesg | grep -i error to see the error messages.


Request: If you find this information useful, please provide your valuable comments.

No comments:

Post a Comment