How to manage images

Some commands for working with images.

# list of images
docker images
docker image ls
docker image ls -a #  list of all images, including intermediate

# download image from public registry 
#(full command: image pull [OPTIONS] IMAGE_NAME[:TAG|@DIGEST])
docker image pull mongo  # load latest mongo db image

# Build image from file Dockerfile in current directory 
docker build

# Build image with specified name 
docker build -t image_name

# Build image from  specified Dockerfile 
docker build -f  my/customfilename.docker

# Build image from stdin
docker build -<<EOF
FROM busybox
RUN echo "hello world"
EOF

# Get detailed information about image
docker image inspect image_name

# Push image to public registry
docker push image_name

# remove dangling images
docker image prune -a

# force remove all docker images
docker rmi $(docker images -q)