Image Commands
# list locally stored images
docker images
docker image ls
docker images -q # IDs only
docker images <image-name> # information about one image
# search Docker Hub
docker search puppet
docker search --filter=stars=10 puppet
docker search --no-trunc puppet
# pull an image
docker pull ubuntu # defaults to the :latest tag
docker pull ubuntu:16.04 # a specific tag
# build
docker build -t <image-name>:<tag> .
docker build -t mongodbimage:1.0 .
docker build -f /path/to/Dockerfile . # Dockerfile at a non-default path
# inspect image history, layer by layer
docker history <image-name>:<tag>
# tag an image (creates an additional reference, not a copy)
docker tag jboss/wildfly myimage:v1
docker tag <image-name>:<tag> <username>/<new-image-name>:<new-tag>
# remove
docker rmi <image-name>:<tag>
docker rmi -f 27d783d4d74d # by ID, forced
docker rmi -f $(docker images -q) # every image on the host
docker search returns the repository name, description, star count, whether the image is
Official (maintained by the upstream project) and whether it is an Automated build. Prefer
official images for base layers.