Docker cheatsheet

By default, only the images that you pulled by name are displayed. To view all images on your local computer, including the unnamed intermediate images that were pulled down to compose the named images that you pulled:

$ docker images -a

To view the full repository name, tag name and ID of images, use the --no-trunc option:

$ docker images --no-trunc

To run a Docker image as a container:

$ docker run image_name

To run a Docker image as a container and get a shell into it:

$ docker run -it image_name /bin/bash

To view all running containers:

$ docker ps

To view all containers, not just the running ones:

$ docker ps -a

To view the full container ID, image name and command use the --no-trunc option:

$ docker ps --no-trunc

To stop a running Docker container provide its container name (not image name) or its container hash: