Browse code

Switch `docker run --username` to `docker run --user` which is more accurate (while we can still do so without breaking anyone's scripts)

Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)

Tianon Gravi authored on 2014/01/14 05:16:12
Showing 3 changed files
... ...
@@ -1778,7 +1778,7 @@ func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf
1778 1778
 		flEntrypoint      = cmd.String([]string{"#entrypoint", "-entrypoint"}, "", "Overwrite the default entrypoint of the image")
1779 1779
 		flHostname        = cmd.String([]string{"h", "-hostname"}, "", "Container host name")
1780 1780
 		flMemoryString    = cmd.String([]string{"m", "-memory"}, "", "Memory limit (format: <number><optional unit>, where unit = b, k, m or g)")
1781
-		flUser            = cmd.String([]string{"u", "-username"}, "", "Username or UID")
1781
+		flUser            = cmd.String([]string{"u", "-user"}, "", "Username or UID")
1782 1782
 		flWorkingDir      = cmd.String([]string{"w", "-workdir"}, "", "Working directory inside the container")
1783 1783
 		flCpuShares       = cmd.Int64([]string{"c", "-cpu-shares"}, 0, "CPU shares (relative weight)")
1784 1784
 
... ...
@@ -497,7 +497,7 @@ _docker_run()
497 497
 			COMPREPLY=( $( compgen -e -- "$cur" ) )
498 498
 			return
499 499
 			;;
500
-		--entrypoint|-h|--hostname|-m|--memory|-u|--username|-w|--workdir|-c|--cpu-shares|-n|--name|-a|--attach|--link|-p|--publish|--expose|--dns|--lxc-conf)
500
+		--entrypoint|-h|--hostname|-m|--memory|-u|--user|-w|--workdir|-c|--cpu-shares|-n|--name|-a|--attach|--link|-p|--publish|--expose|--dns|--lxc-conf)
501 501
 			return
502 502
 			;;
503 503
 		*)
... ...
@@ -506,10 +506,10 @@ _docker_run()
506 506
 
507 507
 	case "$cur" in
508 508
 		-*)
509
-			COMPREPLY=( $( compgen -W "--rm -d --detach -n --networking --privileged -P --publish-all -i --interactive -t --tty --cidfile --entrypoint -h --hostname -m --memory -u --username -w --workdir -c --cpu-shares --sig-proxy --name -a --attach -v --volume --link -e --env -p --publish --expose --dns --volumes-from --lxc-conf" -- "$cur" ) )
509
+			COMPREPLY=( $( compgen -W "--rm -d --detach -n --networking --privileged -P --publish-all -i --interactive -t --tty --cidfile --entrypoint -h --hostname -m --memory -u --user -w --workdir -c --cpu-shares --sig-proxy --name -a --attach -v --volume --link -e --env -p --publish --expose --dns --volumes-from --lxc-conf" -- "$cur" ) )
510 510
 			;;
511 511
 		*)
512
-			local counter=$(__docker_pos_first_nonflag '--cidfile|--volumes-from|-v|--volume|-e|--env|--entrypoint|-h|--hostname|-m|--memory|-u|--username|-w|--workdir|-c|--cpu-shares|-n|--name|-a|--attach|--link|-p|--publish|--expose|--dns|--lxc-conf')
512
+			local counter=$(__docker_pos_first_nonflag '--cidfile|--volumes-from|-v|--volume|-e|--env|--entrypoint|-h|--hostname|-m|--memory|-u|--user|-w|--workdir|-c|--cpu-shares|-n|--name|-a|--attach|--link|-p|--publish|--expose|--dns|--lxc-conf')
513 513
 
514 514
 			if [ $cword -eq $counter ]; then
515 515
 				__docker_image_repos_and_tags_and_ids
... ...
@@ -1010,7 +1010,7 @@ image is removed.
1010 1010
       -p, --publish=[]: Map a network port to the container
1011 1011
       --rm=false: Automatically remove the container when it exits (incompatible with -d)
1012 1012
       -t, --tty=false: Allocate a pseudo-tty
1013
-      -u, --username="": Username or UID
1013
+      -u, --user="": Username or UID
1014 1014
       --dns=[]: Set custom dns servers for the container
1015 1015
       -v, --volume=[]: Create a bind mount with: [host-dir]:[container-dir]:[rw|ro]. If "container-dir" is missing, then docker creates a new volume.
1016 1016
       --volumes-from="": Mount all volumes from the given container(s)