Docker Commands: A Complete Guide to Managing Containers

Last update: 18/03/2025
Author Isaac
  • Docker allows you to manage containers with commands essentials such as run, ps and stop.
  • Images form the basis of containers and are managed with pull, build, and rmi.
  • Volumes facilitate persistent storage with commands like volume create and rm.
  • Docker manages networks with tools like network create, connect, and rm.

Basic Docker Commands

Docker It has become an essential tool for container management, facilitating the development of applications in isolated and scalable environments. The most important Docker commands It is essential to be comfortable using this platform and take full advantage of its features.

In this article, we will explore the main Docker commands, from container management to handling images, volumes, and networks. Whether you're just starting out or want to deepen your knowledge, here's a complete and detailed guide to essential Docker commands.

Docker Architecture and Key Elements

Before we dive into the specific commands, it's important to understand the key elements that make up Docker's architecture:

  • DockerEngine: It is the central engine that allows the execution of containers.
  • Images: They are preconfigured templates that serve as a basis for creating containers.
  • Containers: They are instances of running images, which encapsulate applications and their dependencies.
  • Volumes: They allow data to be stored in a Persistent inside the containers.
  • Networks: They facilitate communication between containers and with the outside world.
Custom images with Dockerfile-3
Related article:
How to create custom images in Docker with Dockerfile

Basic Commands for Managing Containers

Containers are the core of Docker. To manage them properly, you need to know the following commands:

  • docker run: run a contenedor from a image. Example: docker run -d --name mi_contenedor nginx.
  • docker ps: List the containers running. To see all containers, including stopped ones, use docker ps -a.
  • docker stop: Stops a running container. Example: docker stop mi_contenedor.
  • docker start: Start a stopped container. Example: docker start mi_contenedor.
  • docker restart: Restart a container. Example: docker restart mi_contenedor.
  • docker rm: Delete a stopped container. Example: docker rm mi_contenedor.

Container Management in Docker

Commands for Image Management

Images are fundamental in Docker, as they allow you to create environments consistent y reproducibleSome key commands are:

  • Docker images: List all the images stored in the system.
  • docker pull: Download a image from Docker Hub. Example: docker pull ubuntu.
  • docker build: build a image from a Dockerfile. Example: docker build -t mi_imagen ..
  • docker rmi: Delete one image specific. Example: docker rmi mi_imagen.
How to use Docker Compose-2
Related article:
Complete guide to using Docker Compose

Volume Management in Docker

Volumes allow store y share data between containers persistently. Some essential commands are:

  • docker volume create: Create a new volume. Example: docker volume create mi_volumen.
  • docker volume ls: List all the volumes availables.
  • docker volume rm: Delete a specific volume. Example: docker volume rm mi_volumen.
  • docker run -v: Associate a costumes to a container. Example: docker run -v mi_volumen:/datos nginx.

Network Management Commands

Docker offers advanced options for managing networks, allowing communication between containers and with the outside:

  • docker network ls: List all the networks availables.
  • docker network create: create a new RED. Example: docker network create mi_red.
  • docker network connect: Connects a container to a RED. Example: docker network connect mi_red mi_contenedor.
  • docker network rm: Delete one RED. Example: docker network rm mi_red.

Networking in Docker

Mastering these commands will allow you to work efficiently. Management With Docker, streamlining container application management. With this detailed guide, you now have the tools you need to manage images, containers, volumes and networks within Docker in a professional manner.

Related article:
How to fix error code 4294967295

Leave a comment