github.com/chenchun/docker@v1.3.2-0.20150629222414-20467faf132b/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 By default, the container being committed and its processes will be paused 29 while the image is committed. This reduces the likelihood of encountering data 30 corruption during the process of creating the commit. If this behavior is 31 undesired, set the 'p' option to false. 32 33 The `--change` option will apply `Dockerfile` instructions to the image that is 34 created. Supported `Dockerfile` instructions: 35 `CMD`|`ENTRYPOINT`|`ENV`|`EXPOSE`|`ONBUILD`|`USER`|`VOLUME`|`WORKDIR` 36 37 ## Commit a container 38 39 $ docker ps 40 ID IMAGE COMMAND CREATED STATUS PORTS 41 c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours 42 197387f1b436 ubuntu:12.04 /bin/bash 7 days ago Up 25 hours 43 $ docker commit c3f279d17e0a SvenDowideit/testimage:version3 44 f5283438590d 45 $ docker images 46 REPOSITORY TAG ID CREATED VIRTUAL SIZE 47 SvenDowideit/testimage version3 f5283438590d 16 seconds ago 335.7 MB 48 49 ## Commit a container with new configurations 50 51 $ docker ps 52 ID IMAGE COMMAND CREATED STATUS PORTS 53 c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours 54 197387f1b436 ubuntu:12.04 /bin/bash 7 days ago Up 25 hours 55 $ docker inspect -f "{{ .Config.Env }}" c3f279d17e0a 56 [HOME=/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin] 57 $ docker commit --change "ENV DEBUG true" c3f279d17e0a SvenDowideit/testimage:version3 58 f5283438590d 59 $ docker inspect -f "{{ .Config.Env }}" f5283438590d 60 [HOME=/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin DEBUG=true] 61