Cloud Native 13 min read

Master Docker Image Creation, Management, and Transfer: From Pull to Push

This guide explains how Docker images are built from base images, how Docker Hub stores and distributes them, and provides step‑by‑step commands for pulling, committing, tagging, pushing, and importing/exporting images across hosts.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master Docker Image Creation, Management, and Transfer: From Pull to Push

In most cases a Docker image is built on top of an existing base image (e.g., a minimal CentOS, Ubuntu, or Debian). Official base images are created manually by Docker Hub maintainers.

Docker Hub

Docker Hub is a cloud‑based registry service that links to code repositories, builds and tests images, stores manually pushed images, and integrates with Docker Cloud for deployment.

Image repository

Search and pull images from community or official libraries; manage private repositories

Automated builds triggered by source changes

Web UI and webhooks for post‑push actions

Organization support for team access control

GitHub and Bitbucket integration

Getting Docker Images

Use docker pull to retrieve an image from a remote registry.

docker pull (registry)[:(port)]/(namespace)/:(tag)

The registry provides the distribution service (default port 5000) and identifies the specific image.

Image Generation

Images can be created via:

Dockerfile

Commit from a running container

Docker Hub automated builds

Creating an Image from a Container

Use docker commit to snapshot a container as a new image.

docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]

Common options:

--author, -a : author information

-c, --change : apply Dockerfile instructions to the new image

-m, --message : commit message

-p, --pause : pause the container during commit (default true)

# docker pull busybox
# docker run --name bi -it busybox
/ # mkdir data
/ # echo 'nihao' > data/index.html
# docker commit -p bi
sha256:b726393438ac...
# docker tag b726393438ac luojialong123/v1
# docker push luojialong123/v1

After committing, the new image contains the added files. By default the container starts with sh, but you can set a custom entrypoint (e.g., /bin/httpd) when committing.

# docker inspect bi
"Cmd": ["sh"]
"Gateway": "172.17.0.1"
"IPAddress": "172.17.0.2"

Import and Export Images

Use docker save to export an image to a tar file and docker load to import it on another host.

# docker save -o busybox luojialong123/v1
# docker load -i busybox
Loaded image: luojialong123/v1:latest

This method avoids pushing to a registry when you only need to transfer an image between machines.

Additional Exercises

Search for images ( docker search centos), pull them, inspect, and run containers. The article also shows how to compile Apache httpd from source inside a CentOS container, create a custom startup script, commit the container as a new image, and run it with port mapping.

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.

DockerContainerImage ManagementDocker HubDocker Save/Load
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.