Skip to content

Instantly share code, notes, and snippets.

@iain17
Created January 5, 2021 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iain17/9eb9fd3646435841ad8d579a2fb8b898 to your computer and use it in GitHub Desktop.
Save iain17/9eb9fd3646435841ad8d579a2fb8b898 to your computer and use it in GitHub Desktop.
Backup docker containers
#!/bin/bash
mkdir containers | true
containers=`docker ps -a -q | sed -z 's/\n/ /g'`
echo "Backing up $containers"
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock red5d/docker-autocompose $containers > "containers/$(date +"%Y_%m_%d_%I_%M_%p").docker-compose.yml"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment