How to Commit Changes and Create Docker Images

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 Gitand then commit the container.

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.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Safe Passwords

Your server is only as secure as your weakest password. As a rule of thumb, the more complex a...

chkconfig Command Examples for Red Hat and CentOS

View Full List of Services Using chkconfig chkconfig --list View Full List of Services That...

How to Install the Open Query Graph engine (OQGRAPH) for MariaDB 10.0 on CentOS 6

MariaDB is a drop-in replacement for MySQL. It is easy to install, offers many speed and...

How to List Which Apache Modules are Enabled on Ubuntu

The Apache web server is one of the most popular and powerful web servers in the world due to its...

How to use df

The df command is used to view the amount of free diskspace on a server.  The most common usage...

Powered by WHMCompleteSolution