#             Docker Cheatsheet

By [coinvest](https://paragraph.com/@coinvest) · 2023-09-19

---

This is a quick cheat-sheet for the most commonly used Docker Commands.

List Docker CLI commands

`docker docker container --help`

Display Docker version and info

`docker --version docker version docker info`

Excecute Docker image

`docker run hello-world`

List Docker images

`docker image ls`

List Docker containers (running, all, all in quiet mode)

`docker container ls docker container ls -all docker container ls -a -q`

Start docker daemon

`docker -d`

Start a container with an interactive shell

`docker run -ti <image_name> /bin/bash`

“shell” into a running container (docker-1.3+)

`docker exec -ti <container_name> bash`

inspect a running container

`docker inspect <container_name> (or <container_id>)`

Get the process ID for a container

`docker inspect --format {{.State.Pid}} <container_name_or_ID>`

List the current mounted volumes for a container (and pretty print)

`docker inspect --format='{{json .Volumes}}' <container_id> | python -mjson.tool`

Copy files/folders between a container and your host

`docker cp foo.txt mycontainer:/foo.txt`

List currently running containers

`docker ps`

List all containers

`docker ps -a`

List all images

`docker images`

To dive deeper down this rabbit hole: [**Docker Cheat Sheet**](https://github.com/wsargent/docker-cheat-sheet). This is a great and very thorough reference.

---

*Originally published on [coinvest](https://paragraph.com/@coinvest/docker-cheatsheet)*
