Docker for DevOps Engineers

Docker commands indepth

Docker commands are used to interact with the Docker daemon and manage Docker containers, images, and networks. Here are some of the most common Docker commands:

Container Management:

  • docker run: Creates and starts a new container.

  • docker start: Starts an existing container.

  • docker stop: Stops an existing container.

  • docker restart: Restarts an existing container.

  • docker pause: Pauses an existing container.

  • docker unpause: Unpauses an existing container.

  • docker kill: Kills an existing container.

  • docker rm: Removes an existing container.

  • docker ps: Lists running and stopped containers.

Image Management:

  • docker pull: Pulls an image from a registry.

  • docker push: Pushes an image to a registry.

  • docker build: Builds an image from a Dockerfile.

  • docker images: Lists images.

  • docker rmi: Removes an image.

Network Management:

  • docker network create: Creates a new network.

  • docker network ls: Lists networks.

  • docker network rm: Removes a network.

Volume Management:

  • docker volume create: Creates a new volume.

  • docker volume ls: Lists volumes.

  • docker volume rm: Removes a volume.

Other Commands:

  • docker exec: Executes a command in a running container.

  • docker inspect: Gets detailed information about a container, image, or network.

  • docker login: Logs in to a registry.

  • docker logout: Logs out of a registry.