Skip to content

Instantly share code, notes, and snippets.

@gundamew
Created August 16, 2018 07:07
Show Gist options
  • Save gundamew/428b1e72ef7ae7d1a2b9bc7577bcf647 to your computer and use it in GitHub Desktop.
Save gundamew/428b1e72ef7ae7d1a2b9bc7577bcf647 to your computer and use it in GitHub Desktop.
Stop , remove, and rebuild Docker containers.
#!/usr/bin/env bash
set -euo pipefail
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
docker rmi $(docker images --format "{{.Repository}}" | grep 'bsdock')
[[ -f "$PWD/docker-compose.yml" ]] && docker-compose up -d --build
@gundamew
Copy link
Author

gundamew commented Mar 6, 2019

Or replace commands below:

docker stop $(docker ps -aq)
docker rm $(docker ps -aq)

with:

docker-compose down

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment