Day 16 of #90DaysOfDevOps Challenge

Day 16 of #90DaysOfDevOps Challenge

?Docker:

Docker is a containerization tool that helps us create a lightweight container with all the required packages to run our application.

It has the bare minimum binaries and libraries to behave as specified OS. It uses the kernel of your host machine, unlike the virtual machines which have their kernel and OS and are very heavy.

??Why Docker is important:

When a developer works on some application development, he/she creates an environment for that application by installing all the prerequisites. The challenge here is if it is a VM, it is difficult to share the huge file and it takes a lot of time to boot up. If he/she only shares the application then it is hard to replicate the same environment, because the other user does not have knowledge of all the packages and required versions.

In such scenarios, containers play a very important role. A developer can spin up one container, install required dependencies, deploy the application in it, and build the image which he/she can share with the team by uploading it to the private/public repository like docker hub, they can further pull and run that image in their local machine and create a container. The same environment will be up and running within a few mins.

??Difference between Virtualization and containerization:

No alt text provided for this image

?Tasks:

Task 1 -

Use the?docker run?command to start a new container and interact with it through the command line. [Hint: docker run hello-world]

Usage:

docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

Example:

docker run -itd nginx

Options:

-i => Run with an interactive session.

-t => Allocate a pseudo-TTY.

-d => Run container in background and print container ID.

No alt text provided for this image

Task 2 -

Use the?docker inspect?command to view detailed information about a container or image.

Usage:?

docker inspect [OPTIONS] NAME|ID [NAME|ID...]

Return low-level information on Docker objects.

Below is detailed information of the docker container.

No alt text provided for this image

Task 3 -

Use the?docker port?command to list the port mappings for a container.

Usage:?

docker port CONTAINER Name or ID [PRIVATE_PORT[/PROTO]]

List port mappings or specific mapping for the container.

Example:

docker run -itd --name=c1 -p 81:80 nginx
docker port c1
No alt text provided for this image

In the above example, I created a container and did a port mapping to 81 on the host and 80 in the container. And used the docker port command to list the port mapping.

Task 4 -

Use the?docker stats?command to view resource usage statistics for one or more containers.

Usage:?

docker stats [OPTIONS] [CONTAINER...]

Display a live stream of container(s) resource usage statistics.

Example:

docker stats c1
No alt text provided for this image

Task 5 -

Use the?docker top?command to view the processes running inside a container.

Usage:?

docker top CONTAINER [ps OPTIONS]

Display the running processes of a container

No alt text provided for this image

Task 6 -

Use the?docker save?command to save an image to a tar archive.

Usage:?

docker save [OPTIONS] IMAGE [IMAGE...]

Save one or more images to a tar archive (streamed to STDOUT by default)

Example:

docker save -o nginx.tar nginx

Task 7 -

Use the?docker load?command to load an image from a tar archive.

Usage:?

docker load [OPTIONS]

Load an image from a tar archive or STDIN

Example:

docker load -i nginx.tar
No alt text provided for this image

On Task 6, we created a tar file (nginx.tar) from our image (nginx) with the save command, and on this task, we created the image (nginx) using the same tar file (nginx.tar), with the load command.


Thank you for reading! ??

要查看或添加评论,请登录

Aishwarya keshri的更多文章

  • Day26 of #90DaysOfDevOps Challenge

    Day26 of #90DaysOfDevOps Challenge

    Jenkins Pipeline: Jenkins Pipeline is a suite of plugins that supports implementing and integrating continuous delivery…

  • Day24 of #90DaysOfDevOps Challenge

    Day24 of #90DaysOfDevOps Challenge

    ??Project: Containerise and deploy a node.js application using Jenkins Job.

  • Day23 of #90DaysOfDevOps Challenge

    Day23 of #90DaysOfDevOps Challenge

    CI/CD Continuous integration and continuous delivery help in automating the software development lifecycle stages…

    2 条评论
  • Day22 of #90DaysOfDevOps Challenge

    Day22 of #90DaysOfDevOps Challenge

    ??Jenkins Jenkins is an open-source tool that helps in creating pipelines and automating the software development…

  • Day21 of #90DaysOfDevOps Challenge

    Day21 of #90DaysOfDevOps Challenge

    Important interview questions and Answers for Docker: 1. What is the difference between an Image, Container and Engine?…

  • Day20 of #90DaysOfDevOps Challenge

    Day20 of #90DaysOfDevOps Challenge

    Docker Cheat Sheet: ??Docker images- Show all locally stored top-level images: docker images Pull an image from a…

  • Day 19 of #90DaysOfDevOps Challenge

    Day 19 of #90DaysOfDevOps Challenge

    Docker Volumes When we are working on docker, the data we store gets lost when the container is destroyed. So, to…

    2 条评论
  • Day 18 of #90DaysOf DevOps Challenge

    Day 18 of #90DaysOf DevOps Challenge

    ?Docker Compose Using docker commands, we can only run and manage a single container at a time, but there can be…

  • Day17 of #90DaysOfDevOps Challenge

    Day17 of #90DaysOfDevOps Challenge

    Dockerfile: Instead of manually creating docker images by running multiple commands one by one, we can write a script…

    1 条评论
  • Day15 of #90DaysOfDevOps Challenge

    Day15 of #90DaysOfDevOps Challenge

    ?Python Libraries: The collection of modules used in Python while writing different programs is known as libraries…

社区洞察

其他会员也浏览了