Skip to content

Instantly share code, notes, and snippets.

@donny-son
Created September 27, 2025 11:22
Show Gist options
  • Select an option

  • Save donny-son/51270951ea3b86f0ccd746f37388b287 to your computer and use it in GitHub Desktop.

Select an option

Save donny-son/51270951ea3b86f0ccd746f37388b287 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment