Misael  Stark

Misael Stark

1626071280

Docker Containers: Benefits, Usage and Container Commands

In the last tutorial, we briefly touched on the topic of containers and containerizarions. To recall, a container is a standard software unit. It has all the code, and its dependencies packed up in that unit and helps run the application quickly and reliably across the computing environments. So let us discuss Docker containers in this article.

A Docker container is a standalone, lightweight, executable package of software. As already mentioned, since it’s a container, it has everything bundled up together that is needed to run an application like application code, system tools, runtime, binaries, libraries, etc.

As part of Docker containers, we will discuss the following topics in this article.

  • What are Docker containers?
  • Why we need Docker containers?
  • How does a Docker container work?
  • Docker container commands
  • docker run command – launch a container Image/ Run container
  • Next is the docker ps command – List Docker Containers
  • docker commit command – Save Docker containers
  • docker stop command – Stop containers
  • Next is, docker history command – View Docker container history
  • docker top command – View container processes
  • docker rm command – Remove a Container
  • Also, docker stats command – Get the container statistics
  • docker pause command – Pause/unpause a container
  • docker attach command – Attach to a container
  • And, docker kill command – Kill a container
  • How to use privileged Docker containers?
  • Are privileged Docker containers a good idea?
  • How to secure containers?

What are Docker containers?

In our earlier chapter on “Docker Images,” we discussed Docker images in detail. We know that the Docker image is a static entity, and to run the Docker image, we have to associate it with a container. In other words, Docker images become containers at runtime or when they run on Docker Engine.

So a Docker container has the following characteristics:

  • Standard: The Docker containers are portable since they follow the industry standard.
  • Lightweight: Docker containers share the host machine’s OS kernel and hence do not need an OS per application. It reduces licensing and server costs and also gives higher efficiency.
  • Secure: Applications are safer when packaged in Docker containers. Docker also provides the most robust isolation capabilities for its containers in the industry.

Docker containers are the Docker images at runtime and are lightweight, standard, and secure in a nutshell. So when exactly Docker container technology came into existence?

It was in 2013 that the Docker container technology’s launch happened as an open-source Docker Engine.Therefore, one can view the Containers as ‘organizational units’ of Docker. Additionally, we have portable software running in our container. Like cargo ship containers, we can move this container (ship the software), modify, manage, create, remove, or destroy it.

So in simple terms, if the Docker image is a template or blueprint, then the container is a running copy of this image. We can have multiple copies of this image, which means we can have multiple containers with the same image.

#docker #docker containers

Docker Containers: Benefits, Usage and Container Commands