Docker

From HyperSecurity Wiki
Revision as of 06:50, 28 January 2025 by Srapaz (talk | contribs) (Starting/Stopping)
Jump to: navigation, search

Listing

  1. List All Docker Containers:
    • docker ps -a
  2. List all networks:
    • docker network list
  3. Inspect docker container:
    • docker inspect {container id}

Starting/Stopping

  1. Start docker container:
    • docker start {container id}
  2. Stop docker container:
    • docker stop {container id}
  3. Stop all docker containers:
    • docker stop $(docker ps -a -q)
  4. Remove all docker containers:
    • docker stop $(docker ps -a -q)
  5. Starting all docker containers with compose:
    • docker-compose up
  6. Stopping all docker containers with compose:
    • docker-compose down

Accessing Container

  1. Enter a running conntainer
    • docker exec -it {container id} /bin/bash

Deleting/Cleaning

  1. Removing a single container:
    • docker rmi -f {container id}
  2. Delete no longer needed containers:
    • docker container prune
  3. Delete no longer needed images:
    • docker image prune
  4. Delete no longer needed networks:
    • docker network prune
  5. Delete no longer needed trash:
    • docker system prune