Docker CLI
Docker has a command-line interface. The CLI can be used to interact with docker to do things like pull images, build images from dockerfiles, run containers, inspect containers, and more.
docker inspect
docker inspect node:16-stretch
spits out metadata about the image+tag...
- hash
- tags
- env vars
- entrypoint
docker pause and unpause
docker pause <container-id>
'pauses' the container...
- freezes the process
docker unpause <container-id>
run vs exec
run
starts a new containerexec
runs something on an existing containerdocker exec <container-name> bash
- opens bash in a container
connect to a container using exec
docker exec -it <container-name> bash
history
docker history node:12-stretch
- see changes in container/image history
kill all containers
docker kill $(docker ps -q)
docker info
docker info
docker top
- use top to see all process running in a container
docker rm
removes a container
docker rmi
removes an IMAGE
docker container prune
removes all stopped container
docker restart
restarts the container ... some containers don't notice 'restart' signals, like node
search docker hub for a python container
docker search python
searches dockerHub for containers matching the string