2014-04-16 14:07:55 -04:00
|
|
|
% DOCKER(1) Docker User Manuals
|
2014-06-30 22:58:04 -04:00
|
|
|
% Docker Community
|
|
|
|
% JUNE 2014
|
2014-04-16 14:07:55 -04:00
|
|
|
# NAME
|
2014-06-30 22:58:04 -04:00
|
|
|
docker-commit - Create a new image from a container's changes
|
2014-04-16 14:07:55 -04:00
|
|
|
|
|
|
|
# SYNOPSIS
|
2014-06-30 22:58:04 -04:00
|
|
|
**docker commit**
|
|
|
|
[**-a**|**--author**[=*AUTHOR*]]
|
2014-10-15 17:14:12 -04:00
|
|
|
[**--help**]
|
2015-01-09 16:08:26 -05:00
|
|
|
[**-c**|**--change**[= []**]]
|
2014-06-30 22:58:04 -04:00
|
|
|
[**-m**|**--message**[=*MESSAGE*]]
|
2014-07-22 22:40:10 -04:00
|
|
|
[**-p**|**--pause**[=*true*]]
|
2014-11-27 23:21:55 -05:00
|
|
|
CONTAINER [REPOSITORY[:TAG]]
|
2014-04-16 14:07:55 -04:00
|
|
|
|
|
|
|
# DESCRIPTION
|
2015-06-17 09:04:41 -04:00
|
|
|
Create a new image from an existing container specified by name or
|
|
|
|
container ID. The new image will contain the contents of the
|
|
|
|
container filesystem, *excluding* any data volumes.
|
|
|
|
|
|
|
|
While the `docker commit` command is a convenient way of extending an
|
|
|
|
existing image, you should prefer the use of a Dockerfile and `docker
|
|
|
|
build` for generating images that you intend to share with other
|
|
|
|
people.
|
2014-04-16 14:07:55 -04:00
|
|
|
|
|
|
|
# OPTIONS
|
2014-06-30 22:58:04 -04:00
|
|
|
**-a**, **--author**=""
|
|
|
|
Author (e.g., "John Hannibal Smith <hannibal@a-team.com>")
|
2014-04-16 14:07:55 -04:00
|
|
|
|
2015-01-09 16:08:26 -05:00
|
|
|
**-c** , **--change**=[]
|
2015-02-05 06:26:05 -05:00
|
|
|
Apply specified Dockerfile instructions while committing the image
|
2015-07-09 12:57:42 -04:00
|
|
|
Supported Dockerfile instructions: `CMD`|`ENTRYPOINT`|`ENV`|`EXPOSE`|`LABEL`|`ONBUILD`|`USER`|`VOLUME`|`WORKDIR`
|
2015-01-09 16:08:26 -05:00
|
|
|
|
2014-10-15 17:14:12 -04:00
|
|
|
**--help**
|
|
|
|
Print usage statement
|
|
|
|
|
2014-06-30 22:58:04 -04:00
|
|
|
**-m**, **--message**=""
|
2014-04-16 14:07:55 -04:00
|
|
|
Commit message
|
|
|
|
|
2014-07-22 22:40:10 -04:00
|
|
|
**-p**, **--pause**=*true*|*false*
|
|
|
|
Pause container during commit. The default is *true*.
|
2014-06-30 20:39:38 -04:00
|
|
|
|
2014-04-16 14:07:55 -04:00
|
|
|
# EXAMPLES
|
|
|
|
|
|
|
|
## Creating a new image from an existing container
|
2014-04-21 13:55:06 -04:00
|
|
|
An existing Fedora based container has had Apache installed while running
|
2014-04-16 14:07:55 -04:00
|
|
|
in interactive mode with the bash shell. Apache is also running. To
|
2015-04-09 04:37:23 -04:00
|
|
|
create a new image run `docker ps` to find the container's ID and then run:
|
2014-04-16 14:07:55 -04:00
|
|
|
|
2014-06-04 21:41:45 -04:00
|
|
|
# docker commit -m="Added Apache to Fedora base image" \
|
2014-06-04 21:25:55 -04:00
|
|
|
-a="A D Ministrator" 98bd7fc99854 fedora/fedora_httpd:20
|
2014-04-16 14:07:55 -04:00
|
|
|
|
2015-07-01 11:15:17 -04:00
|
|
|
Note that only a-z0-9-_. are allowed when naming images from an
|
|
|
|
existing container.
|
|
|
|
|
2015-02-05 06:26:05 -05:00
|
|
|
## Apply specified Dockerfile instructions while committing the image
|
|
|
|
If an existing container was created without the DEBUG environment
|
|
|
|
variable set to "true", you can create a new image based on that
|
2015-04-09 04:37:23 -04:00
|
|
|
container by first getting the container's ID with `docker ps` and
|
2015-02-05 06:26:05 -05:00
|
|
|
then running:
|
2015-01-09 16:08:26 -05:00
|
|
|
|
|
|
|
# docker commit -c="ENV DEBUG true" 98bd7fc99854 debug-image
|
|
|
|
|
2014-04-16 14:07:55 -04:00
|
|
|
# HISTORY
|
|
|
|
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
2014-07-01 20:30:25 -04:00
|
|
|
based on docker.com source material and in
|
2014-06-30 22:58:04 -04:00
|
|
|
June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
2014-07-22 22:40:10 -04:00
|
|
|
July 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
2015-01-09 16:08:26 -05:00
|
|
|
Oct 2014, updated by Daniel, Dao Quang Minh <daniel at nitrous dot io>
|
2015-07-01 11:15:17 -04:00
|
|
|
June 2015, updated by Sally O'Malley <somalley@redhat.com>
|