December 08, 2017

Docker Commands: docker commit

Docker Commands: docker commit


docker commit <container ID>

Containers by default are ephemeral and stateless. Changes made while in the container are discarded when the container is removed. One way to persist container updates or configuration changes, is to "freeze" the container, i.e. convert it back into an image.

The docker commit command creates a new image, incorporating any changes made while a container. You can: start a container, configure it to taste, then commit those changes into a new Docker image:


The new container (started from this newly generated image) reflects the changes configured in the original container.


Note: Building an image via docker commit is not considered a best practice; it is not repeatable or self-documenting, like using docker build and the Dockerfile.

Creative Commons License Licensed under a Creative Commons Attribution 4.0 International License.

No comments:

Post a Comment