Master Docker Commands: Images, Pull, Save, Load, Run, and Manage Containers
This guide explains the difference between Docker image and images, demonstrates how to list, pull, save, load, and remove images, and shows how to run, start, stop, and list containers using essential Docker commands.
docker image vs images
Docker images can be used directly, while the singular
docker imagecommand is for managing images and cannot list them directly. Example output of
docker imagesshows available images.
<code># docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest a9d583973f65 2 years ago 1.23MB
nginx latest 298ec0e28760 2 years ago 133MB</code>docker pull
The
docker pullcommand downloads a specified image to the local host.
<code># docker pull alpine
Using default tag: latest
latest: Pulling from library/alpine
ca3cd42a7c95: Pull complete
Digest: sha256:e103c1b4bf019dc290bcc7aca538dc2bf7a9d0fc836e186f5fa34945c5168310
Status: Downloaded newer image for alpine:latest</code>docker save
docker saveexports an image to a tar archive file.
<code># docker save busybox > busybox.tar
# ls
busybox.tar</code>docker load
docker loadimports a tar archive created by
docker saveas a Docker image.
<code># docker load -i busybox.tar
2983725f2649: Loading layer 1.45MB/1.45MB
Loaded image: busybox:latest</code>docker rmi
docker rmiremoves one or more images from the local registry.
<code># docker rmi alpine
Untagged: alpine:latest
Untagged: alpine@sha256:e103c1b4bf019dc290bcc7aca538dc2bf7a9d0fc836e186f5fa34945c5168310
Deleted: sha256:49f356fa4513676c5e22e3a8404aad6c7262cc7aaed15341458265320786c58c</code>docker run
docker runcreates and starts a new container from an image. Options
-itdallocate a pseudo‑TTY, keep STDIN open, and run in detached mode.
<code># docker run -itd nginx
4c45f7885e57...</code>docker start | stop
docker startstarts a stopped container;
docker stopstops a running container.
<code># docker stop bold_shockley
# docker start bold_shockley</code>docker ps
docker pslists running containers; adding
-ashows all containers, including stopped ones.
<code># docker ps
# docker ps -a</code>Raymond Ops
Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.