covert docker (commit|import|tag) to use REPOSITORY[:TAG]
| ... | ... |
@@ -904,7 +904,7 @@ func (cli *DockerCli) CmdKill(args ...string) error {
|
| 904 | 904 |
} |
| 905 | 905 |
|
| 906 | 906 |
func (cli *DockerCli) CmdImport(args ...string) error {
|
| 907 |
- cmd := Subcmd("import", "URL|- [REPOSITORY [TAG]]", "Create a new filesystem image from the contents of a tarball(.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz).")
|
|
| 907 |
+ cmd := Subcmd("import", "URL|- [REPOSITORY[:TAG]]", "Create a new filesystem image from the contents of a tarball(.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz).")
|
|
| 908 | 908 |
|
| 909 | 909 |
if err := cmd.Parse(args); err != nil {
|
| 910 | 910 |
return nil |
| ... | ... |
@@ -913,7 +913,8 @@ func (cli *DockerCli) CmdImport(args ...string) error {
|
| 913 | 913 |
cmd.Usage() |
| 914 | 914 |
return nil |
| 915 | 915 |
} |
| 916 |
- src, repository, tag := cmd.Arg(0), cmd.Arg(1), cmd.Arg(2) |
|
| 916 |
+ src := cmd.Arg(0) |
|
| 917 |
+ repository, tag := utils.ParseRepositoryTag(cmd.Arg(1)) |
|
| 917 | 918 |
v := url.Values{}
|
| 918 | 919 |
v.Set("repo", repository)
|
| 919 | 920 |
v.Set("tag", tag)
|
| ... | ... |
@@ -1230,14 +1231,16 @@ func (cli *DockerCli) CmdPs(args ...string) error {
|
| 1230 | 1230 |
} |
| 1231 | 1231 |
|
| 1232 | 1232 |
func (cli *DockerCli) CmdCommit(args ...string) error {
|
| 1233 |
- cmd := Subcmd("commit", "[OPTIONS] CONTAINER [REPOSITORY [TAG]]", "Create a new image from a container's changes")
|
|
| 1233 |
+ cmd := Subcmd("commit", "[OPTIONS] CONTAINER [REPOSITORY[:TAG]]", "Create a new image from a container's changes")
|
|
| 1234 | 1234 |
flComment := cmd.String("m", "", "Commit message")
|
| 1235 | 1235 |
flAuthor := cmd.String("author", "", "Author (eg. \"John Hannibal Smith <hannibal@a-team.com>\"")
|
| 1236 | 1236 |
flConfig := cmd.String("run", "", "Config automatically applied when the image is run. "+`(ex: {"Cmd": ["cat", "/world"], "PortSpecs": ["22"]}')`)
|
| 1237 | 1237 |
if err := cmd.Parse(args); err != nil {
|
| 1238 | 1238 |
return nil |
| 1239 | 1239 |
} |
| 1240 |
- name, repository, tag := cmd.Arg(0), cmd.Arg(1), cmd.Arg(2) |
|
| 1240 |
+ name := cmd.Arg(0) |
|
| 1241 |
+ repository, tag := utils.ParseRepositoryTag(cmd.Arg(1)) |
|
| 1242 |
+ |
|
| 1241 | 1243 |
if name == "" {
|
| 1242 | 1244 |
cmd.Usage() |
| 1243 | 1245 |
return nil |
| ... | ... |
@@ -1532,7 +1535,7 @@ func (opts PathOpts) Set(val string) error {
|
| 1532 | 1532 |
} |
| 1533 | 1533 |
|
| 1534 | 1534 |
func (cli *DockerCli) CmdTag(args ...string) error {
|
| 1535 |
- cmd := Subcmd("tag", "[OPTIONS] IMAGE REPOSITORY [TAG]", "Tag an image into a repository")
|
|
| 1535 |
+ cmd := Subcmd("tag", "[OPTIONS] IMAGE REPOSITORY[:TAG]", "Tag an image into a repository")
|
|
| 1536 | 1536 |
force := cmd.Bool("f", false, "Force")
|
| 1537 | 1537 |
if err := cmd.Parse(args); err != nil {
|
| 1538 | 1538 |
return nil |
| ... | ... |
@@ -1543,10 +1546,10 @@ func (cli *DockerCli) CmdTag(args ...string) error {
|
| 1543 | 1543 |
} |
| 1544 | 1544 |
|
| 1545 | 1545 |
v := url.Values{}
|
| 1546 |
- v.Set("repo", cmd.Arg(1))
|
|
| 1547 |
- if cmd.NArg() == 3 {
|
|
| 1548 |
- v.Set("tag", cmd.Arg(2))
|
|
| 1549 |
- } |
|
| 1546 |
+ repository, tag := utils.ParseRepositoryTag(cmd.Arg(1)) |
|
| 1547 |
+ |
|
| 1548 |
+ v.Set("repo", repository)
|
|
| 1549 |
+ v.Set("tag", tag)
|
|
| 1550 | 1550 |
|
| 1551 | 1551 |
if *force {
|
| 1552 | 1552 |
v.Set("force", "1")
|
| ... | ... |
@@ -133,7 +133,6 @@ to the ``docker`` daemon. ``ADD`` doesn't work when running in this |
| 133 | 133 |
mode because the absence of the context provides no source files to |
| 134 | 134 |
copy to the container. |
| 135 | 135 |
|
| 136 |
- |
|
| 137 | 136 |
.. code-block:: bash |
| 138 | 137 |
|
| 139 | 138 |
sudo docker build github.com/creack/docker-firefox |
| ... | ... |
@@ -151,7 +150,7 @@ by using the ``git://`` schema. |
| 151 | 151 |
|
| 152 | 152 |
:: |
| 153 | 153 |
|
| 154 |
- Usage: docker commit [OPTIONS] CONTAINER [REPOSITORY [TAG]] |
|
| 154 |
+ Usage: docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]] |
|
| 155 | 155 |
|
| 156 | 156 |
Create a new image from a container's changes |
| 157 | 157 |
|
| ... | ... |
@@ -160,7 +159,26 @@ by using the ``git://`` schema. |
| 160 | 160 |
-run="": Configuration to be applied when the image is launched with `docker run`. |
| 161 | 161 |
(ex: '{"Cmd": ["cat", "/world"], "PortSpecs": ["22"]}')
|
| 162 | 162 |
|
| 163 |
-Full -run example (multiline is ok within a single quote ``'``) |
|
| 163 |
+Simple commit of an existing container |
|
| 164 |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
| 165 |
+ |
|
| 166 |
+.. code-block:: bash |
|
| 167 |
+ |
|
| 168 |
+ $ docker ps |
|
| 169 |
+ ID IMAGE COMMAND CREATED STATUS PORTS |
|
| 170 |
+ c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours |
|
| 171 |
+ 197387f1b436 ubuntu:12.04 /bin/bash 7 days ago Up 25 hours |
|
| 172 |
+ $ docker commit c3f279d17e0a SvenDowideit/testimage:version3 |
|
| 173 |
+ f5283438590d |
|
| 174 |
+ $ docker images | head |
|
| 175 |
+ REPOSITORY TAG ID CREATED SIZE |
|
| 176 |
+ SvenDowideit/testimage version3 f5283438590d 16 seconds ago 204.2 MB (virtual 335.7 MB) |
|
| 177 |
+ S |
|
| 178 |
+ |
|
| 179 |
+Full -run example |
|
| 180 |
+................. |
|
| 181 |
+ |
|
| 182 |
+(multiline is ok within a single quote ``'``) |
|
| 164 | 183 |
|
| 165 | 184 |
:: |
| 166 | 185 |
|
| ... | ... |
@@ -317,7 +335,7 @@ Displaying images visually |
| 317 | 317 |
|
| 318 | 318 |
:: |
| 319 | 319 |
|
| 320 |
- Usage: docker import URL|- [REPOSITORY [TAG]] |
|
| 320 |
+ Usage: docker import URL|- [REPOSITORY[:TAG]] |
|
| 321 | 321 |
|
| 322 | 322 |
Create a new filesystem image from the contents of a tarball |
| 323 | 323 |
|
| ... | ... |
@@ -333,14 +351,16 @@ Examples |
| 333 | 333 |
Import from a remote location |
| 334 | 334 |
............................. |
| 335 | 335 |
|
| 336 |
-``$ sudo docker import http://example.com/exampleimage.tgz exampleimagerepo`` |
|
| 336 |
+This will create a new untagged image. |
|
| 337 |
+ |
|
| 338 |
+``$ sudo docker import http://example.com/exampleimage.tgz`` |
|
| 337 | 339 |
|
| 338 | 340 |
Import from a local file |
| 339 | 341 |
........................ |
| 340 | 342 |
|
| 341 | 343 |
Import to docker via pipe and standard in |
| 342 | 344 |
|
| 343 |
-``$ cat exampleimage.tgz | sudo docker import - exampleimagelocal`` |
|
| 345 |
+``$ cat exampleimage.tgz | sudo docker import - exampleimagelocal:new`` |
|
| 344 | 346 |
|
| 345 | 347 |
Import from a local directory |
| 346 | 348 |
............................. |
| ... | ... |
@@ -719,7 +739,7 @@ The main process inside the container will receive SIGTERM, and after a grace pe |
| 719 | 719 |
|
| 720 | 720 |
:: |
| 721 | 721 |
|
| 722 |
- Usage: docker tag [OPTIONS] IMAGE REPOSITORY [TAG] |
|
| 722 |
+ Usage: docker tag [OPTIONS] IMAGE REPOSITORY[:TAG] |
|
| 723 | 723 |
|
| 724 | 724 |
Tag an image into a repository |
| 725 | 725 |
|