Common command combos...
Starting composition and checking what is running
Starts all containers described in docker-compose.yml file
dcpup
dls
Expect images to include all the images listed in the docker-compose.yml file
Expect running containers to include all containers described in the docker-compose.yml file
Expect all containers to include all loaded containers whether or not they are running.
Expect services to include all services described in the docker-compose.yml file
Cleaning up
Starting/stopping containers and building images can create a messy environment. If you want to start fresh, do the following...
Shut down compositions
dls
dcpdown
dls
Remove remaining containers
dcpruneall
dls
Expect the running containers and all containers lists to be empty.
Remove images
dcpruneall
dls
Expect all lists to be empty.
My shortcuts...
shortcut | full command | description | when to use |
---|---|---|---|
'docker image' command short cuts | |||
dihelp | docker image help | Docker official help for 'docker image' commands | |
dib $1 | docker image build -t $1 . | Build a docker image from Dockerfile and assign $1=name/tag (e.g. elr/qa_server) | |
dirm $1 | docker image remove $1 . | Remove a docker image given its $1=name/tag (e.g. elr/qa_server) | |
dils | docker image ls | List docker images | |
diprune | docker image prune -a | Remove all images that do not have containers | |
dipull $1 | docker image pull $1 | Pull a docker image from docker hub by $1=name (e.g. solr) or name/tag (e.g. elr/qa_server) | |
dipush $1 | docker image push $1 | Push a docker image to docker hub =name or name/tag (e.g. elr/qa_server) NOTE: won't be pushing anything by name only | |
'docker container' command short cuts | |||
dchelp | Docker official help for docker container commands | ||
dcall | List all docker containers running or not | ||
dcrun | List only running docker containers | ||
dcprune | Remove all STOPPED containers | ||
dcpruneall | Remove all STOPPED and RUNNING containers | ||
dcgo $1 | Start a container by docker assigned name (e.g. $1=sleepy_boyd) or id (e.g. $1=fb213) | ||
dcstop $1 | Stop a container by docker assigned name (e.g. $1=sleepy_boyd) or id (e.g. $1=fb213) | ||
dcstopall | Stop all running containers | ||
dcrestart $1 | Restart a container by docker assigned name (e.g. $1=sleepy_boyd) or id (e.g. $1=fb213) | ||
dckill $1 | Kill a container by docker assigned name (e.g. $1=sleepy_boyd) or id (e.g. $1=fb213) | ||
'docker container run' command short cuts | |||
dcrhelp | Docker official help for docker container run commands | ||
dcr $@ | Execute 'docker container run $@' command appending all arguments with $@ | ||
dcrit $@ | Execute 'docker container run -it $@' command appending all arguments with $@ | ||
dcrport $1 $2 | Run a named container identified by $2=name/tag (e.g. elr/qa_server) on a specific port $1 (e.g. 3000) | ||
drrs $1 | Run spec tests for docker container identified by $1=name/tag:version (e.g. $1=elr/qa_server:v1) | ||
dbash $1 | Run bash command line for docker container identified by $1=name/tag:version (e.g. $1=elr/qa_server:v1) <CTRL><D> to end | ||
'docker-compose' command short cuts | |||
dcphelp | Docker official help for docker-compose commands | ||
dcpls | List services started by docker-compose based on services defined in docker-compose-yml | ||
dcpa $1 | Attach to a service running through docker-compose identified by $1=Name listed by dcpls (e.g. $1=app) <CTRL><P> <CTRL><Q> to detach from the container | ||
dcpb | Build a docker composition based on docker-compose.yml NOTE: Containers do not run with build. See dcpup NOTE: name is defined in docker-compose.yml at top level (e.g. apache:) | ||
dcpup $1 | Build and run a container from the docker composition identified by $1=name (e.g. apache). Build and run all containers if name is not specified. | ||
dcpdown $1 | Stop running and remove a container from the docker composition identified by $1=name (e.g. apache). Stop and remove all containers defined in docker composition if name is not specified. | ||
dcpstop $1 | Stop running a container from the docker composition identified by $1=name (e.g. apache). Stop all containers defined in docker composition if name is not specified. | ||
dcprestart $1 | Restart a running container from the docker composition identified by $1=name (e.g. apache). Restart all containers defined in docker composition if name is not specified. | ||
dcplogs $1 | Show the logs for a container from the docker composition identified by $1=name (e.g. apache) |