Cloud Native 5 min read

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.

Raymond Ops
Raymond Ops
Raymond Ops
Master Docker Commands: Images, Pull, Save, Load, Run, and Manage Containers

docker image vs images

Docker images can be used directly, while the singular

docker image

command is for managing images and cannot list them directly. Example output of

docker images

shows 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 pull

command 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 save

exports an image to a tar archive file.

<code># docker save busybox > busybox.tar
# ls
busybox.tar</code>

docker load

docker load

imports a tar archive created by

docker save

as a Docker image.

<code># docker load -i busybox.tar
2983725f2649: Loading layer 1.45MB/1.45MB
Loaded image: busybox:latest</code>

docker rmi

docker rmi

removes 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 run

creates and starts a new container from an image. Options

-itd

allocate a pseudo‑TTY, keep STDIN open, and run in detached mode.

<code># docker run -itd nginx
4c45f7885e57...</code>

docker start | stop

docker start

starts a stopped container;

docker stop

stops a running container.

<code># docker stop bold_shockley
# docker start bold_shockley</code>

docker ps

docker ps

lists running containers; adding

-a

shows all containers, including stopped ones.

<code># docker ps
# docker ps -a</code>
dockerDevOpsCommandLineContainerManagementImageManagement
Raymond Ops
Written by

Raymond Ops

Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.