This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 "|------|-------|--------|-------|--------------|" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| docker run \ | |
| --name {{printf "%q" .Name}} \ | |
| {{- with .HostConfig}} | |
| {{- if .Privileged}} | |
| --privileged \ | |
| {{- end}} | |
| {{- if .AutoRemove}} | |
| --rm \ | |
| {{- end}} | |
| {{- if .Runtime}} |