Saravanan's Corner: Blackberry Dev

Friday, 18 July 2025

Docker Commands

 Docker commands are used to manage Docker containers and images. Some of the most common commands include docker rundocker psdocker stopdocker startdocker rmdocker imagesdocker pull, and docker push. 

Here's a breakdown of some essential Docker commands:
Container Management:
  • docker run [OPTIONS] IMAGE [COMMAND] [ARG...]Creates and starts a new container from an image. 
  • docker psLists running containers. 
    • docker ps -a: Lists all containers (running and stopped). 
  • docker stop [CONTAINER...]Stops one or more running containers. 
  • docker start [CONTAINER...]Starts one or more stopped containers. 
  • docker restart [CONTAINER...]Restarts one or more running containers. 
  • docker kill [CONTAINER...]Kills one or more running containers (sends SIGKILL). 
  • docker rm [CONTAINER...]Removes one or more stopped containers. 
  • docker exec -it [CONTAINER] [COMMAND]Executes a command in a running container. 
  • docker logs [OPTIONS] CONTAINERFetches the logs of a container. 
  • docker inspect [CONTAINER...]Displays detailed information about one or more containers. 
  • docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-Copies files/folders between a container and the local filesystem. 
Image Management:
  • docker imagesLists all images on the host.
  • docker pull IMAGE[:TAG]Downloads an image from a registry.
  • docker push IMAGE[:TAG]Uploads an image to a registry.
  • docker rmi IMAGE [IMAGE...]Removes one or more images.
  • docker build [OPTIONS] PATHBuilds an image from a Dockerfile. 
Other Useful Commands:
  • docker versionDisplays the Docker version information.
  • docker infoDisplays system-wide information.
  • docker search TERMSearches Docker Hub for images.
  • docker network lsLists all networks.
  • docker volume lsLists all volumes.
  • docker system pruneRemoves stopped containers, dangling images, and unused networks and volumes.
  • docker compose upBuilds, creates, starts, and attaches to containers for a project.
  • docker compose downStops and removes containers, networks, and volumes. 

No comments:

Post a Comment