25th Anniversary Savings | 25% Off Dedicated Servers*Shop Now
25th Anniversary Savings | 25% Off VPS Hosting* †††Shop Now
Limited Inventory: High-Performance AMD-Powered Servers Now Available.* Shop Now >
Dedicated Hosting Deals | From $99/moShop Now
Earn hosting credits and a chance to win an Amazon gift card when you refer friends to Liquid Web!Read our promo rules

How to Commit Changes and Create Docker Images

Reading Time: 2 minutes

Pre-Flight Check
  • As of June 2014 Docker has officially released v1.0.0.
  • These instructions are intended for committing changes to Docker containers.
  • I’ll be working from a Liquid Web Core Managed CentOS 6.6 server (or CentOS 7, Ubuntu 14.04 LTS, Fedora 20, Fedora 21), and I’ll be logged in as root.
  • In the previous tutorials in this series we’ve installed Docker and got a container running, and then we listed which containers were running, and attached to a running Fedora container.

Commit Changes to Docker

To create a new image from changes to a container, it’s a simple as running just one command. Before we do so, however, let’s change the container!

Within this container we are free to do anything we would typically do on Fedora. In this case, we’re going to install Git and then commit the container. The linked instructions are for installing Git on CentOS 6, but they’ll work for this Fedora container too.

Once you’ve completed those instructions you can disconnect, or detach, from the shell without exiting use the escape sequence Ctrl-p + Ctrl-q.

Finally it’s time to commit our changes to a named image. This command converts the container 9c09acd48a25 to an image with the name fedora-base-with-git:

docker commit 9c09acd48a25 fedora-base-with-git

Docker uses the “commits are cheap” concept in its design. You’re encouraged to commit frequently and at any point in an image’s history, much like version control.

About the Author: J. Mays

As a previous contributor, JMays shares his insight with our Knowledge Base center. In our Knowledge Base, you'll be able to find how-to articles on Ubuntu, CentOS, Fedora and much more!

Latest Articles

How to Edit the PHP Memory for Your WordPress Site via WP Toolkit

Read Article

What is CGI-Bin and What Does it Do?

Read Article

Top 10 Password Security Standards

Read Article

Top 10 Password Security Standards

Read Article

How to Use the WP Toolkit to Secure and Update WordPress

Read Article