Docker cheatsheet

  • To view Docker images available on your local computer:
$ docker images
  • 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:
$ docker stop container_name

Tried with: Docker 17.09 and Ubuntu 16.04

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.