Docker

From HyperSecurity Wiki
Revision as of 06:46, 28 January 2025 by Srapaz (talk | contribs)
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)

Accessing Container

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

Deleting/Cleaning

  1. Delete no longer needed containers:
    • docker container prune
  2. Delete no longer needed images:
    • docker image prune
  3. Delete no longer needed networks:
    • docker network prune
  4. Delete no longer needed trash:
    • docker system prune