Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com> (github: dqminh)
Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
| ... | ... |
@@ -8,6 +8,7 @@ docker-commit - Create a new image from a container's changes |
| 8 | 8 |
**docker commit** |
| 9 | 9 |
[**-a**|**--author**[=*AUTHOR*]] |
| 10 | 10 |
[**--help**] |
| 11 |
+[**-c**|**--change**[= []**]] |
|
| 11 | 12 |
[**-m**|**--message**[=*MESSAGE*]] |
| 12 | 13 |
[**-p**|**--pause**[=*true*]] |
| 13 | 14 |
CONTAINER [REPOSITORY[:TAG]] |
| ... | ... |
@@ -19,6 +20,9 @@ Using an existing container's name or ID you can create a new image. |
| 19 | 19 |
**-a**, **--author**="" |
| 20 | 20 |
Author (e.g., "John Hannibal Smith <hannibal@a-team.com>") |
| 21 | 21 |
|
| 22 |
+**-c** , **--change**=[] |
|
| 23 |
+ Apply a modification in Dockerfile format before committing the image. |
|
| 24 |
+ |
|
| 22 | 25 |
**--help** |
| 23 | 26 |
Print usage statement |
| 24 | 27 |
|
| ... | ... |
@@ -38,8 +42,17 @@ create a new image run docker ps to find the container's ID and then run: |
| 38 | 38 |
# docker commit -m="Added Apache to Fedora base image" \ |
| 39 | 39 |
-a="A D Ministrator" 98bd7fc99854 fedora/fedora_httpd:20 |
| 40 | 40 |
|
| 41 |
+## Modify configuration settings before committing the image |
|
| 42 |
+An existing container was created without the necessary environment variable |
|
| 43 |
+DEBUG set to "true". To create a new image based on the container with a |
|
| 44 |
+correct DEBUG environment variable, run docker ps to find the container's ID |
|
| 45 |
+and then run |
|
| 46 |
+ |
|
| 47 |
+ # docker commit -c="ENV DEBUG true" 98bd7fc99854 debug-image |
|
| 48 |
+ |
|
| 41 | 49 |
# HISTORY |
| 42 | 50 |
April 2014, Originally compiled by William Henry (whenry at redhat dot com) |
| 43 | 51 |
based on docker.com source material and in |
| 44 | 52 |
June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> |
| 45 | 53 |
July 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> |
| 54 |
+Oct 2014, updated by Daniel, Dao Quang Minh <daniel at nitrous dot io> |
| ... | ... |
@@ -694,6 +694,7 @@ you refer to it on the command line. |
| 694 | 694 |
Create a new image from a container's changes |
| 695 | 695 |
|
| 696 | 696 |
-a, --author="" Author (e.g., "John Hannibal Smith <hannibal@a-team.com>") |
| 697 |
+ -c, --change=[] Apply a modification in Dockerfile format before committing the image |
|
| 697 | 698 |
-m, --message="" Commit message |
| 698 | 699 |
-p, --pause=true Pause container during commit |
| 699 | 700 |
|
| ... | ... |
@@ -720,6 +721,19 @@ If this behavior is undesired, set the 'p' option to false. |
| 720 | 720 |
REPOSITORY TAG ID CREATED VIRTUAL SIZE |
| 721 | 721 |
SvenDowideit/testimage version3 f5283438590d 16 seconds ago 335.7 MB |
| 722 | 722 |
|
| 723 |
+#### Commit an existing container with new configurations |
|
| 724 |
+ |
|
| 725 |
+ $ sudo docker ps |
|
| 726 |
+ ID IMAGE COMMAND CREATED STATUS PORTS |
|
| 727 |
+ c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours |
|
| 728 |
+ 197387f1b436 ubuntu:12.04 /bin/bash 7 days ago Up 25 hours |
|
| 729 |
+ $ sudo docker inspect -f "{{ .Config.Env }}" c3f279d17e0a
|
|
| 730 |
+ [HOME=/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin] |
|
| 731 |
+ $ sudo docker commit --change "ENV DEBUG true" c3f279d17e0a SvenDowideit/testimage:version3 |
|
| 732 |
+ f5283438590d |
|
| 733 |
+ $ sudo docker inspect -f "{{ .Config.Env }}" f5283438590d
|
|
| 734 |
+ [HOME=/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin DEBUG=true] |
|
| 735 |
+ |
|
| 723 | 736 |
## cp |
| 724 | 737 |
|
| 725 | 738 |
Copy files/folders from a container's filesystem to the host |