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