Skip to content

Instantly share code, notes, and snippets.

@tcelestino
Last active June 14, 2019 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tcelestino/d3c6d53a1c72fa2ab81bc039ae81dd1d to your computer and use it in GitHub Desktop.
Save tcelestino/d3c6d53a1c72fa2ab81bc039ae81dd1d to your computer and use it in GitHub Desktop.
Essentials Docker commands -

Essentials Docker commands

List all essentials command to use Docker. Based on https://hackernoon.com/docker-commands-the-ultimate-cheat-sheet-994ac78e2888

Running Docker

  • docker start [container]: Start a particular container.
  • docker stop [container]: Stop a particular container.
  • docker exec -ti [container] [command]: Run a shell command inside a particular container.
  • docker run -ti — image [image] [container] [command]: Create and start a container at the same time, and then run a command inside it.
  • docker run -ti — rm — image [image] [container] [command]: Create and start a container at the same time, run a command inside it, and then remove the container after executing the command.
  • docker pause [container]: Pause all processes running within a particular container.

Docker Utilities

  • docker images: List all of the images that are currently stored on the system.
  • docker inspect [object]: Display low-level information about a particular Docker object.
  • docker history [image]: Display the history of a particular image.
  • docker ps: List all of the containers that are currently running.
  • docker version: Display the version of Docker that is currently installed on the system.

Delete, kill...

  • docker kill [container]: Kill a particular container.
  • docker kill $(docker ps -q): Kill all containers that are currently running.
  • docker rm [container]: Delete a particular container that is not currently running.
  • docker rm $(docker ps -a -q): Delete all containers that are not currently running.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment