Docker container overview and commands
Docker has become an integral part of software engineering. We use Docker for development, testing, and deployment because it’s easy to manage the environment. Because of its portability, it has become popular in the software industry.

Docker container overview and commands

I take this opportunity to explain Docker in the most straightforward way. In this blog, the following concepts will be covered:

  • Why is Docker needed??
  • What is Docker?
  • How does Docker work?
  • Features/benefits
  • Docker Commands

?Why is Docker needed : Docker is a containerization platform that packages your application and all its dependencies together in the form of a docker container to ensure that your application works seamlessly in any environment.

What is Docker: Docker is considered a popular application containerization platform in the IT world.?This open-source software allows developers to easily combine applications with?dependencies, operating systems, libraries, and other?run-time-related resources?in containers and automatically deploy them on any infrastructure as native-cloud architectures and multi-cloud environments are becoming popular for most organizations.

How does Docker work: Docker Engine is the main component of the Docker ecosystem.?The Docker engine creates a server-side daemon and a client-side CLI.?The server-side daemon stores the Containers, images, data, and network images while the client-side CLI allows you to communicate with the server using APIs.?Docker Containers are called Dockerfiles.

No alt text provided for this image

Features/Benefits: Docker provides a variety of benefits to organizations.?Here are some of the key benefits provided by this tool.

  1. Increase productivity: Compared to virtual machines, Docker containers are easier to build, deploy, and manage.?They complement the?cloud-native architecture?and?CI/CD pipelines?based on DevOps, thereby helping developers deliver quality software faster.
  2. Seamless migration across infrastructures: In contrast to Linux?containers?that use machine-specific configurations, Docker containers are?machine-agnostic,?platform-agnostic,?and?OS-agnostic.?Therefore, they can be easily migrated across any infrastructure.
  3. Containers with a light capacity: ?Each Docker?container?contains a single process making it extremely lightweight.?At the same time, it allows you to update the application in detail.?You can edit/modify a certain process without taking the app down.
  4. Automatically create Containers: Docker can take your application's source code and create containers automatically.?It can also take existing containers as a base image template and recreate containers that you can reuse.?It also comes with a versioning mechanism, which means that each Docker image can be rolled up easily.
  5. Cost Optimization: The ability to run more code per server allows you to increase productivity with minimal overhead.?Optimal use of resources will help save costs.?In addition, standardized operations allow for automation, saving time and human resources which save costs.
  6. Wide support: Docker gets great support from the community.?You get the benefit of thousands of user-uploaded?containers?in the open-source registry instead of spending time rebuilding from scratch.

Docker Commands: Following are the commands which are being covered

  • docker –version: This command is used to get the currently installed version of docker.

Usages: docker --version

  • docker pull: This command is used to pull images from the?docker repository.

Usages: docker pull <image name>

  • docker run: This command is used to create a container from an image.

Usages: docker run -it -d <image name>

  • docker ps: This command is used to list the running containers.

Usages: docker ps

  • docker ps -a: This command is used to show all the running and exited containers

Usages: docker ps -a

  • docker exec: This command is used to access the running container

Usages: docker exec -it <container id> bash

  • docker stop: This command stops a running container

Usages: docker stop <container id>

  • ?docker kill: This command kills the container by stopping its execution immediately. The difference between ‘docker kill’ and ‘docker stop’ is that ‘docker stop’ gives the container time to shut down gracefully, in situations when it is taking too much time to get the container to stop, one can opt to kill it.

Usages: docker kill <container id>

  • docker commit: This command creates a new image of an edited container on the local system

Usage: docker commit <conatainer id> <username/imagename>

  • docker login: This command is used to login to the docker hub repository

Usage: docker login

  • docker push: This command is used to push an image to the docker hub repository.

Usage: docker push <username/image name>

  • docker images: This command lists all the locally stored docker images

Usage: docker images

  • docker rm: This command is used to delete a stopped container.

Usage: ?docker rm <container id>

  • docker rmi: This command is used to delete an image from local storage.

Usage: docker rmi <image-id>

  • docker build: This command is used to build an image from a specified docker file.

Usage: docker build <path to docker file>

Register for our latest webinar on Managing applications with kubernetes.?? Registration Link: https://lnkd.in/ggysxK5g #docker #kubernetes #course #registernow

回复

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

社区洞察

其他会员也浏览了