Docker: Basics: images & containers
11 Docker commands: Basics: images & containers. Click a command to see what each part does.
Docker: Basics: images & containersIndex
- Whole sheet120
- Basics: images & containers11
- Volumes & networks4
- Find & inspect containers7
- Environment variables & container config12
- Software versions inside containers & images9
- Logs & shells5
- Run containers3
- Images4
- Cleanup6
- Docker Compose v27
- Container lifecycle & live changes10
- Builds, multi-platform & moving images11
- Volumes, networks & remote hosts in depth12
- Compose: more commands9
- Swarm mode10
Basics: images & containers11
docker version; docker infoIs Docker installed and running?What each part does
docker versionclient and server (daemon) versions; an error on Server means the daemon is not runningdocker infosystem-wide details: containers, images, storage driver, cgroup driver
docker run --rm hello-worldTest that everything worksWhat each part does
docker runcreate and start a container (pulls the image if missing)--rmremove the container when it exitshello-worldtiny test image that prints a greeting
docker imagesList local imagesWhat each part does
docker imagesalias of docker image ls: repository, tag, image ID, size
docker pull <image>:<tag>Download an imageWhat each part does
docker pulldownload from a registry (Docker Hub by default)<image>:<tag>e.g. nginx:1.27; without a tag it means :latest
docker ps; docker ps -aList running / all containersWhat each part does
docker psrunning containers-ainclude stopped ones
docker start <container>; docker stop <container>; docker restart <container>Start, stop, restart a containerWhat each part does
startstart a stopped container (keeps its data and settings)stopgraceful stop: SIGTERM, then SIGKILL after 10s (-t to change)restartstop then start
docker rm <container>Remove a containerCautionWhat each part does
docker rmdelete a stopped container; add -f to stop and delete a running one
docker rmi <image>:<tag>Remove an imageCautionWhat each part does
docker rmidelete a local image; -f forces it even if tagged elsewhere
docker rename <old-name> <new-name>Rename a containerWhat each part does
docker renamechange the container name
docker port <container>Which host port maps to the container?What each part does
docker portlist port mappings, e.g. 80/tcp -> 0.0.0.0:8080
docker login <registry>; docker logout <registry>Log in / out of a registryWhat each part does
docker loginstore credentials (Docker Hub if no registry is given)docker logoutremove them
Nothing matches.
My DevOps Playbook by Angelo John Calleja