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.

  • 220 Пользователи нашли это полезным
Помог ли вам данный ответ?

Связанные статьи

How to List Compiled PHP Modules from Command Line

Pre-Flight Check These instructions are intended specifically for listing compiled PHP modules...

How to Install or Uninstall PECL Extensions

Pre-Flight Check These instructions are intended specifically for installing or uninstalling...

How to Install the MongoDB PHP Driver (Extension) on CentOS 6

Step 1: Setup Environment, Install PHP Extension & Application Repository (PEAR) As a matter...

How to Add a User and Grant Root Privileges on CentOS 6.5

Step 1: Add the User It’s just one simple command to add a user. In this case, we’re...

How to Add a User and Grant Root Privileges on Ubuntu 14.04

Step 1: Add the User It’s just one simple command to add a user. In this case, we’re...