Skip to content

Instantly share code, notes, and snippets.

View donny-son's full-sized avatar

monjiboi donny-son

View GitHub Profile
@donny-son
donny-son / container_management.sh
Created September 27, 2025 11:22
Temporarily save running docker containers and rerun them based on container ID list
# running container IDs into a txt list
docker ps -q > running_containers.txt
# stop containers based on container ID txt list
for id in $(cat running_containers.txt); do docker stop $id; done
# rerun containers based on container ID txt list
for id in $(cat running_containers.txt); do docker start $id; done
@donny-son
donny-son / docker_ps_to_md
Created September 27, 2025 11:19
`docker ps` into a markdown table
#!/bin/bash
# Function to create markdown table from docker ps output using JSON format
docker_ps_to_markdown() {
echo "# Docker Containers"
echo ""
# Print header
echo "| Name | Image | Status | Ports | Container ID |"
echo "|------|-------|--------|-------|--------------|"
@donny-son
donny-son / run.tpl
Created March 5, 2023 03:47 — forked from efrecon/run.tpl
`docker inspect` template to regenerate the `docker run` command that created a container
docker run \
--name {{printf "%q" .Name}} \
{{- with .HostConfig}}
{{- if .Privileged}}
--privileged \
{{- end}}
{{- if .AutoRemove}}
--rm \
{{- end}}
{{- if .Runtime}}