Day 16 Task: Docker Introduction

Day 16 Task: Docker Introduction

Containers vs. virtual machines

Containers and virtual machines are very similar resource virtualization technologies. Virtualization is the process in which a system singular resource like RAM, CPU, Disk, or Networking can be ‘virtualized’ and represented as multiple resources. The key differentiator between containers and virtual machines is that virtual machines virtualize an entire machine down to the hardware layers and containers only virtualize software layers above the operating system level.

Docker

Docker is a software platform that allows you to build, test, and deploy applications quickly. Docker packages software into standardized units called containers that have everything the software needs to run including libraries, system tools, code, and runtime. Using Docker, you can quickly deploy and scale applications into any environment and know your code will run.

Task:-

1 . how to install Docker?

sudo apt-get update
sudo apt-get install docker.io
docker --version
sudo usermod -aG docker $USER   
[this command is use for give permisson then not required sudo every time before command]
sudo reboot      ------it is required after previous command

Use the docker run command to start a new container and interact with it through the command line.

docker run -td --name <cantainer name> -p 80:80 <image name>

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

      docker inspect < container-name >
    

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

      docker stats <container id >
    

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

      docker top <container id>
    

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

      docker save -o name.tar <image>
    

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

docker load -i <image.tar>

Thank you ........