Operations 5 min read

Essential Docker Commands: From Images to Containers and Registry

This guide walks through fundamental Docker commands for inspecting Docker versions, managing images, running and inspecting containers, committing changes, handling container lifecycle, saving/loading images, logging into registries, and publishing images to a registry.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Essential Docker Commands: From Images to Containers and Registry

1. View Docker Information

Check Docker version: docker version Show system information:

docker info

2. Image Operations

Search for an image: docker search image_name Download an image: docker pull image_name List images: docker images Remove one or more images: docker rmi image_name Show image history:

docker history image_name

3. Run Containers

Run a container to echo "hello word": docker run image_name echo "hello word" Start an interactive shell: docker run -i -t image_name /bin/bash Install a program inside a container:

docker run image_name apt-get install -y app_name

4. Inspect Containers

List running containers: docker ps List all containers: docker ps -a Show the most recently started container:

docker ps -l

5. Save Container Changes

Create a new image from a container:

docker commit ID new_image_name

6. Container Management

Remove all containers: docker rm `docker ps -a -q` Remove a single container: docker rm Name/ID Stop, start, or kill a container: docker stop Name/ID, docker start Name/ID, docker kill Name/ID Fetch container logs: docker logs Name/ID Show changed files/directories: docker diff Name/ID Display processes inside a container: docker top Name/ID Copy files from container to host: docker cp Name:/container_path to_path or docker cp ID:/container_path to_path Restart a running container: docker restart Name/ID Attach to a running container:

docker attach ID

7. Save and Load Images

Export an image to a tar file: docker save image_name -o file_path Import an image from a tar file:

docker load -i file_path

8. Login to Registry

Log in to a Docker registry:

docker login

9. Publish Image

Push an image to a registry:

docker push new_image_name
Docker tutorial illustration
Docker tutorial illustration
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DockerContainerTutorialImagecommands
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

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.