Browse code

Deprecate 'docker insert'

'docker insert' is an old command which predates 'docker build'. We no
longer recommend using it, it is not actively maintained, and can be
replaced with the combination of 'docker build' and 'ADD'.

This removes the command from usage and documentation, and prints a
warning when it is called.

The command still works but it will be removed in a future version.

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)

Solomon Hykes authored on 2014/04/04 08:47:58
Showing 5 changed files
... ...
@@ -56,7 +56,6 @@ func (cli *DockerCli) CmdHelp(args ...string) error {
56 56
 		{"images", "List images"},
57 57
 		{"import", "Create a new filesystem image from the contents of a tarball"},
58 58
 		{"info", "Display system-wide information"},
59
-		{"insert", "Insert a file in an image"},
60 59
 		{"inspect", "Return low-level information on a container"},
61 60
 		{"kill", "Kill a running container"},
62 61
 		{"load", "Load an image from a tar archive"},
... ...
@@ -85,7 +84,9 @@ func (cli *DockerCli) CmdHelp(args ...string) error {
85 85
 	return nil
86 86
 }
87 87
 
88
+// FIXME: 'insert' is deprecated.
88 89
 func (cli *DockerCli) CmdInsert(args ...string) error {
90
+	fmt.Fprintf(os.Stderr, "Warning: '%s' is deprecated and will be removed in a future version. Please use 'docker build' and 'ADD' instead.\n")
89 91
 	cmd := cli.Subcmd("insert", "IMAGE URL PATH", "Insert a file from URL in the IMAGE at PATH")
90 92
 	if err := cmd.Parse(args); err != nil {
91 93
 		return nil
... ...
@@ -458,6 +458,7 @@ func getImagesSearch(eng *engine.Engine, version version.Version, w http.Respons
458 458
 	return job.Run()
459 459
 }
460 460
 
461
+// FIXME: 'insert' is deprecated as of 0.10, and should be removed in a future version.
461 462
 func postImagesInsert(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
462 463
 	if err := parseForm(r); err != nil {
463 464
 		return err
... ...
@@ -753,34 +753,6 @@ preserved.
753 753
 	WARNING: No swap limit support
754 754
 
755 755
 
756
-.. _cli_insert:
757
-
758
-``insert``
759
-
760
-::
761
-
762
-    Usage: docker insert IMAGE URL PATH
763
-
764
-    Insert a file from URL in the IMAGE at PATH
765
-
766
-Use the specified ``IMAGE`` as the parent for a new image which adds a
767
-:ref:`layer <layer_def>` containing the new file. The ``insert`` command does
768
-not modify the original image, and the new image has the contents of the parent
769
-image, plus the new file.
770
-
771
-
772
-Examples
773
-~~~~~~~~
774
-
775
-Insert file from GitHub
776
-.......................
777
-
778
-.. code-block:: bash
779
-
780
-    $ sudo docker insert 8283e18b24bc https://raw.github.com/metalivedev/django/master/postinstall /tmp/postinstall.sh
781
-    06fd35556d7b
782
-
783 756
 .. _cli_inspect:
784 757
 
785 758
 ``inspect``
... ...
@@ -640,6 +640,7 @@ func TestImagesFilter(t *testing.T) {
640 640
 	}
641 641
 }
642 642
 
643
+// FIXE: 'insert' is deprecated and should be removed in a future version.
643 644
 func TestImageInsert(t *testing.T) {
644 645
 	eng := NewTestEngine(t)
645 646
 	defer mkRuntimeFromEngine(eng, t).Nuke()
... ...
@@ -82,6 +82,7 @@ func InitServer(job *engine.Job) engine.Status {
82 82
 	job.Eng.Hack_SetGlobalVar("httpapi.server", srv)
83 83
 	job.Eng.Hack_SetGlobalVar("httpapi.runtime", srv.runtime)
84 84
 
85
+	// FIXME: 'insert' is deprecated and should be removed in a future version.
85 86
 	for name, handler := range map[string]engine.Handler{
86 87
 		"export":           srv.ContainerExport,
87 88
 		"create":           srv.ContainerCreate,
... ...
@@ -641,7 +642,9 @@ func (srv *Server) ImagesSearch(job *engine.Job) engine.Status {
641 641
 	return engine.StatusOK
642 642
 }
643 643
 
644
+// FIXME: 'insert' is deprecated and should be removed in a future version.
644 645
 func (srv *Server) ImageInsert(job *engine.Job) engine.Status {
646
+	fmt.Fprintf(job.Stderr, "Warning: '%s' is deprecated and will be removed in a future version. Please use 'build' and 'ADD' instead.\n", job.Name)
645 647
 	if len(job.Args) != 3 {
646 648
 		return job.Errorf("Usage: %s IMAGE URL PATH\n", job.Name)
647 649
 	}