Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

CommandDescription
docker versionList information about the docker version and the API version, etc.
docker --versionList limited information
docker eventsThis gets real time docker events from the server.  Options include filter, format, since, and until.  To exit, use Control C

docker ps

docker ps -a

List running containers (-a will list all existing containers)
docker stop xxxxx

 docker stop --help

Usage:  docker stop [OPTIONS] CONTAINER [CONTAINER...]

Stop one or more running containers

Options:
  -t, --time int   Seconds to wait for stop before killing it (default 10)

docker rm

docker rm --help

Usage:  docker rm [OPTIONS] CONTAINER [CONTAINER...]

Remove one or more containers

Options:
  -f, --force     Force the removal of a running container (uses SIGKILL)
  -l, --link      Remove the specified link
  -v, --volumes   Remove anonymous volumes associated with the container

docker imagesList the images
docker inspect imagename

Inspect an image - needs fully qualified name  You can pipe it through grep to get specific information

You can filter for different information - see examples

docker exec -it containername /bin/bashConnect to a running docker container.  Note we DO NOT recommend you connect directly to a redesign docker container except as recommended by SSDT staff.
docker pause / unpausePauses / unpauses the processes within one or more containers.  Note that if a container is paused, it must be unpaused (not started).
docker statsShows running statistics about docker containers.  Note on later versions of docker (tested on 17.12), by default this command will contain the container name rather than the id.  You can also run stats for a specific container

docker stats --format "table {{.Name}}\t{{.MemUsage}}\t{{.MemPerc}}"

Docker stats command formatted to be more easily readable
docker system prune

WARNING - this will remove all stopped containers, all networks not used by at least one container, build cache, and all dangling images.  USE WITH CAUTION. Since removing volumes is a destructive event (all data will be lost in the volume), it is not a default operation. To remove volumes, a flag can be passed (--volumes), or the volume prune command used (see volume commands).  Other flags include --all  or -a (to remove ALL unused images), and --force or -f (to override the confirmation prompt).  This can also be used in conjunction with other commands for a complete docker system refresh (stop and remove all containers and prune)

...