Browse code

Add --link accept container ID

Signed-off-by: Lei Jitang <leijitang@huawei.com>

Lei Jitang authored on 2015/01/13 10:38:12
Showing 2 changed files
... ...
@@ -752,10 +752,7 @@ func (daemon *Daemon) RegisterLinks(container *Container, hostConfig *runconfig.
752 752
 			if err != nil {
753 753
 				return err
754 754
 			}
755
-			child, err := daemon.GetByName(parts["name"])
756
-			if err != nil {
757
-				return err
758
-			}
755
+			child := daemon.Get(parts["name"])
759 756
 			if child == nil {
760 757
 				return fmt.Errorf("Could not get container for %s", parts["name"])
761 758
 			}
... ...
@@ -66,7 +66,7 @@ func Parse(cmd *flag.FlagSet, args []string) (*Config, *HostConfig, *flag.FlagSe
66 66
 
67 67
 	cmd.Var(&flAttach, []string{"a", "-attach"}, "Attach to STDIN, STDOUT or STDERR.")
68 68
 	cmd.Var(&flVolumes, []string{"v", "-volume"}, "Bind mount a volume (e.g., from the host: -v /host:/container, from Docker: -v /container)")
69
-	cmd.Var(&flLinks, []string{"#link", "-link"}, "Add link to another container in the form of name:alias")
69
+	cmd.Var(&flLinks, []string{"#link", "-link"}, "Add link to another container in the form of <name|id>:alias")
70 70
 	cmd.Var(&flDevices, []string{"-device"}, "Add a host device to the container (e.g. --device=/dev/sdc:/dev/xvdc:rwm)")
71 71
 
72 72
 	cmd.Var(&flEnv, []string{"e", "-env"}, "Set environment variables")