Skip to content

Instantly share code, notes, and snippets.

@YarekTyshchenko
Last active January 6, 2016 14:15
Show Gist options
  • Save YarekTyshchenko/2a00beed20996aea5fd4 to your computer and use it in GitHub Desktop.
Save YarekTyshchenko/2a00beed20996aea5fd4 to your computer and use it in GitHub Desktop.

Remove dangling images:

docker images -q --filter dangling=true | xargs docker rmi

Remove stopped containers:

docker ps -q --filter status=exited | xargs docker rm -vf

Remove dangling volumes:

docker volume ls -q --filter dangling=true | xargs docker volume rm

Host hack without running a container: --add-host hostname:IP

Trash everything

docker ps -aq | xargs docker rm -vf
docker images -aq | xargs docker rmi -f

Flatten image:

docker export <image> | docker import - <new_name>

Docker Container lifecycle: https://docs.docker.com/reference/api/docker_remote_api/

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