github.com/miqui/docker@v1.9.1/man/docker-commit.1.md (about)

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