Sometimes you explore in a running container and want to keep the result. docker commit snapshots the container’s filesystem into a new local image. From there you can tag and push to Docker Hub (or any OCI registry).
For production, prefer a Dockerfile: commits are hard to audit and easy to drift. Use commit for experiments and demos; use Dockerfiles for anything you ship.
Commit changes
Assume you installed tools inside an Ubuntu container with ID abc123:
docker commit -m "added curl and jq" -a "Your Name" abc123 youruser/ubuntu-tools:0.1.0
docker images
Replace youruser with your Docker Hub username (or organization).
Log in and push
docker login
docker push youruser/ubuntu-tools:0.1.0
Others (or your other machines) can then:
docker pull youruser/ubuntu-tools:0.1.0
docker run -it -- youruser/ubuntu-tools:0.1.0 bash