Keeping track of all my containers can be difficult.
Dockerbash is a few short shell scripts which run Docker commands for:
- remembering to tag images
- deleting dangling images and other leftovers
- stopping detached containers which I forgot about
- running interactive containers which self-destruct when finished
- showing all my containers, images, volumes, and networks
- Clone this repo to a folder on your machine.
- Open a
terminal
and
cd
to that folder. bin/runit hello-world
to run a test container.
Scripts are in the bin folder. You might need to chmod them if they are not executable.
description | command |
---|---|
build an image and tag it | bake TAG [CONTEXT] |
delete all containers and leftovers | clean |
delete an image and any containers using it | delete IMAGE |
stop all containers create from an image | kill IMAGE |
run an interactive, self-destructing container | runit [OPTIONS] IMAGE [CMD] |
show images, volumes, networks, and containers | show |
Build (or rebuild) myimage:v2
with path/to/some/folder
as the
build context.
bin/bake myimage:v2 path/to/some/folder
Run bash
in an interactive, self-destructing myimage:v2
container.
bin/runit myimage:v2 bash
Delete myimage:v2
and any containers
descended from it.
bin/delete myimage:v2
Stop all containers descended from myimage:v2
.
bin/kill myimage:v2
- Docker CLI
- Docker run
- Dockerfile