Skip to content

cluemediator/docker-commands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

Docker Commands: A Comprehensive List

Thank you for checking out this project! If you find it useful, please consider giving it a star ⭐. Pull requests are always welcome and greatly appreciated. For more technical updates, follow us on Twitter @ClueMediator.

Note: This repository is dedicated to showcasing Docker commands only. If you're interested in more technical content, please visit Clue Mediator's GitHub profile.

Table of Contents

Docker Commands

  • Process Management

  • Volumes & Ports

    • List volumes

      docker volume ls

      ⬆ Back to Top

    • Create a volume

      docker volume create <volume>

      ⬆ Back to Top

    • Delete a volume

      docker volume rm <volume>

      ⬆ Back to Top

    • Show volume metadata

      docker volume inspect <volume>

      ⬆ Back to Top

    • Delete all volumes not attached to a container

      docker volume prune

      ⬆ Back to Top

    • Mount a local directory to your container

      docker run -v <local_dir>:<container_dir> <image>

      ⬆ Back to Top

    • Copy file or folder from a docker container to host machine

      docker cp container>:<container_dir> <local_dir>

      ⬆ Back to Top

    • Copy file or folder from local machine onto a container

      docker cp <local_dir> <container>:<container_dir>

      ⬆ Back to Top

    • Map a local port to a docker instance

      docker run -d -p 127.0.0.1:<local_port>:<docker_port> <image>

      ⬆ Back to Top

    • List the ports a docker container is running on

      docker port <container>

      ⬆ Back to Top

  • Docker Compose

    • Start your docker-compose defined resources in detached mode

      docker-compose up -d -f <docker_compose_yaml>

      ⬆ Back to Top

    • Stop all docker-compose resources

      docker-compose stop

      ⬆ Back to Top

    • Destroy all docker-compose resources

      docker-compose down

      ⬆ Back to Top

    • Show docker-compose processes

      docker-compose ps

      ⬆ Back to Top

    • Show docker-compose logs

      docker-compose logs

      ⬆ Back to Top

    • Show docker-compose resource consumption

      docker-compose top

      ⬆ Back to Top

  • Images/Repository

  • Troubleshooting

    • Show the logs of a container

      docker logs <container>

      ⬆ Back to Top

    • Follow/tail the logs of a container

      docker logs -f <container>

      ⬆ Back to Top

    • Show timestamps on docker logs

      docker logs -t <container>

      ⬆ Back to Top

    • Show details/metadata of a container

      docker inspect <container>

      ⬆ Back to Top

    • Show a 'top' view of processes running on a container

      docker top <container>

      ⬆ Back to Top

    • Show a 'top' view of all docker containers

      docker stats

      ⬆ Back to Top

    • Show any files that have changed since startup

      docker diff <container>

      ⬆ Back to Top

    • Connect to an already running container

      docker attach <container>

      ⬆ Back to Top

    • Execute a command on a container

      docker exec -it <container_id> /bin/bash

      ⬆ Back to Top

    • Show docker system wide information

      docker system info

      ⬆ Back to Top

    • Show docker disk space used

      docker system df

      ⬆ Back to Top


Happy Coding...!! 😊