I have found myself learning and relearning Docker basics because I only dive into it every few months, and it took me several days just to find my notes from last time, so I am pushing this to my blog for safe keeping.
If this is your first time with Docker consider starting here with a tutorial, it helps you get started by either installing all the requisite bits locally or using an interactive online playground.
Here are the commands I lean on most to manage my local Docker images and containers:
# Show a list of images
# Show a list of containers
docker container ls
# start up a container from the dasblogweb:latest
docker run -ti dasblogweb:latest
# Create a new image from a container (preferably after making changes you want to keep)
docker commit c5534sdf343 my-new-image
# Create an image from a dockerfile in this directory "."
docker build -t "some-image" .
# Tag you build with a new
docker tag mywebapp poppastring/mywebapp
# Push out to docker hub…
docker push poppastring/mywebapp
# Stop container with id d86ead82e236
docker stop d86ead82e236
# Remove all containers
docker rm $(docker ps -a -q)
# List only the stopped containers
docker ps --filter "status=exited"
# Force delete image
docker rmi asdf8wewrw –f
# Force delete all images
docker rmi $(docker images -q)