github.com/slene/docker@v1.8.0-rc1/docs/reference/commandline/commit.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "commit"
     4  description = "The commit command description and usage"
     5  keywords = ["commit, file, changes"]
     6  [menu.main]
     7  parent = "smn_cli"
     8  weight=1
     9  +++
    10  <![end-metadata]-->
    11  
    12  # commit
    13  
    14      Usage: docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
    15  
    16      Create a new image from a container's changes
    17  
    18        -a, --author=""     Author (e.g., "John Hannibal Smith <hannibal@a-team.com>")
    19        -c, --change=[]     Apply specified Dockerfile instructions while committing the image
    20        -m, --message=""    Commit message
    21        -p, --pause=true    Pause container during commit
    22  
    23  It can be useful to commit a container's file changes or settings into a new
    24  image. This allows you debug a container by running an interactive shell, or to
    25  export a working dataset to another server. Generally, it is better to use
    26  Dockerfiles to manage your images in a documented and maintainable way.
    27  
    28  The commit operation will not include any data contained in
    29  volumes mounted inside the container.
    30  
    31  By default, the container being committed and its processes will be paused
    32  while the image is committed. This reduces the likelihood of encountering data
    33  corruption during the process of creating the commit.  If this behavior is
    34  undesired, set the 'p' option to false.
    35  
    36  The `--change` option will apply `Dockerfile` instructions to the image that is
    37  created.  Supported `Dockerfile` instructions:
    38  `CMD`|`ENTRYPOINT`|`ENV`|`EXPOSE`|`LABEL`|`ONBUILD`|`USER`|`VOLUME`|`WORKDIR`
    39  
    40  ## Commit a container
    41  
    42      $ docker ps
    43      ID                  IMAGE               COMMAND             CREATED             STATUS              PORTS
    44      c3f279d17e0a        ubuntu:12.04        /bin/bash           7 days ago          Up 25 hours
    45      197387f1b436        ubuntu:12.04        /bin/bash           7 days ago          Up 25 hours
    46      $ docker commit c3f279d17e0a  SvenDowideit/testimage:version3
    47      f5283438590d
    48      $ docker images
    49      REPOSITORY                        TAG                 ID                  CREATED             VIRTUAL SIZE
    50      SvenDowideit/testimage            version3            f5283438590d        16 seconds ago      335.7 MB
    51  
    52  ## Commit a container with new configurations
    53  
    54      $ docker ps
    55      ID                  IMAGE               COMMAND             CREATED             STATUS              PORTS
    56      c3f279d17e0a        ubuntu:12.04        /bin/bash           7 days ago          Up 25 hours
    57      197387f1b436        ubuntu:12.04        /bin/bash           7 days ago          Up 25 hours
    58      $ docker inspect -f "{{ .Config.Env }}" c3f279d17e0a
    59      [HOME=/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin]
    60      $ docker commit --change "ENV DEBUG true" c3f279d17e0a  SvenDowideit/testimage:version3
    61      f5283438590d
    62      $ docker inspect -f "{{ .Config.Env }}" f5283438590d
    63      [HOME=/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin DEBUG=true]
    64