Most Used Docker Commands

Tiempo de lectura: 2 minutos

Reading Time: 2 minutes

Below are some of the most useful and commonly used Docker commands along with usage examples:

  1. docker run The docker run command is used to start a Docker container from an image. For example, if you want to start an Ubuntu container:
docker run ubuntu
  1. docker ps The docker ps command shows a list of all running containers. To display all containers (including those not running), you can use the -a option.
docker ps
  1. docker stop The docker stop command is used to stop a running container. For example, if you want to stop a container with ID 123456789:
docker stop 123456789
  1. docker rm The docker rm command is used to remove a container. For example, if you want to remove a container with ID 123456789:
docker rm 123456789
  1. docker images The docker images command shows a list of all downloaded Docker images on the system.
docker images
  1. docker pull The docker pull command is used to download a Docker image from a repository.
docker pull ubuntu
  1. docker push The docker push command is used to upload a Docker image to a repository.
docker push myrepository/myimage
  1. docker build The docker build command is used to build a Docker image from a Dockerfile.
docker build -t myimage .
  1. docker-compose The docker-compose command is used to manage multiple Docker containers through a YAML file.
docker-compose up
docker-compose down
  1. docker exec The docker exec command is used to execute a command in a running container.
docker exec -it mycontainer bash

These are just some of the most commonly used and useful Docker commands. There are many more commands and options available in Docker, and more details can be found in the official Docker documentation.

Leave a Comment