Day 16: Docker for DevOps.

Day 16: Docker for DevOps.

Here I have covered,

  • What is Docker?

  • What is "Image" in Docker?

  • What is a "Container" in Docker?

  • What is a "Container Image" in Docker?

  • Docker Commands.

What is Docker?

  • Docker is a container platform that allows you to build, test and deploy applications quickly.

  • A Developer defines all the applications and their dependencies in a Dockerfile which is then used to build docker images that define Docker container.

  • Doing this ensures that your application will run in any environment.

What is "Image" in Docker?

  • In Docker, an image is a lightweight, stand-alone, executable package that includes everything needed to run a piece of software, including the code, runtime, libraries, environment variables, and any other dependencies.

  • Docker images are typically built using a Dockerfile, which is a text file that contains a set of instructions for creating the image.

What is "Container" in Docker?

  • A Container is a way to package applications with everything they need inside the package including the dependencies & Configuration.

What is "Container Image" in Docker?

  • When running a container, it uses an isolated file system. This custom file system is provided by a container image.

  • Since the image contains the container's file system, it must contain everything needed to run an application -all dependencies, configurations, scripts, binaries etc.

  • The image also contains other configurations for the container such as environment variables, a default command to run and other metadata.


How to check Docker Version?

docker version


Docker Commands:

  • docker pull <image_name> -> This command is used to image from the local repository or from DockerHub.

docker pull

  • docker container -> This command is used to list all the containers of images.

docker container ls

  • docker run <image_id> -> Docker run means to run an image to create a container.

docker run

Docker Desktop AppView

docker run desktop view

Running in Interactive Environment

docker run -it command

  • docker inspect <image_id> -> It will give all the information of the container.(eg.state,path,id)

docker inspect

  • docker port -> This command is used for mapping port for containers.

docker port

WebView on httpport:27017

docker http port 27017

  • docker stats <image_id> -> This command shows the resource usage statistics for one or more containers.

docker stats

docker stats shown

  • docker top <container_id> -> This command shows the processes running inside a container.

docker top

  • docker save -> This command is used to save an image to a tar archive. docker save [OPTIONS] IMAGE [IMAGE...]

docker save

docker save folder view

  • docker load -> This command is used to load an image from a tar archive.

docker load


Happy Learning :)

Did you find this article valuable?

Support DevOps by becoming a sponsor. Any amount is appreciated!