Docker
Docker Cheat Sheet
Quick Installation Script (Linux)
To quickly install Docker on supported Linux distributions, you can use the following script. First, download the script:
curl -fsSL https://get.docker.com -o get-docker.shNext, make the script executable:
chmod +x get-docker.shFinally, execute the script:
./get-docker.shListing Docker Containers
Before accessing a container, you need its name or ID. Use the following command to list running containers:
docker psAccessing a Running Container with Bash
To open a Bash shell inside a running Docker container:
docker exec -it <container_id_or_name> bashStopping All Running Docker Containers
To stop all currently running Docker containers:
docker kill $(sudo docker ps -q)How It Works:
The docker ps -q command lists only the IDs of all running containers. These IDs are then passed to docker kill, which stops all the specified containers.
Cleaning Up Docker Containers
To remove all unused containers, images, networks, and volumes:
docker system prune --all --volumes--all removes all unused images, not just dangling ones.--volumes also removes all unused volumes.
By default, Docker will prompt for confirmation. To skip the prompt, add --force.
Viewing Docker Container Logs
To view the logs of a specific Docker container:
docker logs wg-easy