Browse code

Removing 'exec' feature from the CLI until the docker daemon supports resizing of tty sessions for exec'ed commands.

Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)

Vishnu Kannan authored on 2014/09/16 02:06:07
Showing 3 changed files
... ...
@@ -2299,77 +2299,3 @@ func (cli *DockerCli) CmdLoad(args ...string) error {
2299 2299
 	}
2300 2300
 	return nil
2301 2301
 }
2302
-
2303
-func (cli *DockerCli) CmdExec(args ...string) error {
2304
-	cmd := cli.Subcmd("exec", "[OPTIONS] CONTAINER COMMAND [ARG...]", "Run a command in an existing container")
2305
-
2306
-	execConfig, err := runconfig.ParseExec(cmd, args)
2307
-	if err != nil {
2308
-		return err
2309
-	}
2310
-	if execConfig.Container == "" {
2311
-		cmd.Usage()
2312
-		return nil
2313
-	}
2314
-
2315
-	if execConfig.Detach {
2316
-		_, _, err := cli.call("POST", "/containers/"+execConfig.Container+"/exec", execConfig, false)
2317
-		return err
2318
-	}
2319
-	var (
2320
-		out, stderr io.Writer
2321
-		in          io.ReadCloser
2322
-		// We need to instanciate the chan because the select needs it. It can
2323
-		// be closed but can't be uninitialized.
2324
-		hijacked = make(chan io.Closer)
2325
-		errCh    chan error
2326
-	)
2327
-	// Block the return until the chan gets closed
2328
-	defer func() {
2329
-		log.Debugf("End of CmdExec(), Waiting for hijack to finish.")
2330
-		if _, ok := <-hijacked; ok {
2331
-			log.Errorf("Hijack did not finish (chan still open)")
2332
-		}
2333
-	}()
2334
-
2335
-	if execConfig.AttachStdin {
2336
-		in = cli.in
2337
-	}
2338
-	if execConfig.AttachStdout {
2339
-		out = cli.out
2340
-	}
2341
-	if execConfig.AttachStderr {
2342
-		if execConfig.Tty {
2343
-			stderr = cli.out
2344
-		} else {
2345
-			stderr = cli.err
2346
-		}
2347
-	}
2348
-	errCh = utils.Go(func() error {
2349
-		return cli.hijack("POST", "/containers/"+execConfig.Container+"/exec?", execConfig.Tty, in, out, stderr, hijacked, execConfig)
2350
-	})
2351
-
2352
-	// Acknowledge the hijack before starting
2353
-	select {
2354
-	case closer := <-hijacked:
2355
-		// Make sure that hijack gets closed when returning. (result
2356
-		// in closing hijack chan and freeing server's goroutines.
2357
-		if closer != nil {
2358
-			defer closer.Close()
2359
-		}
2360
-	case err := <-errCh:
2361
-		if err != nil {
2362
-			log.Debugf("Error hijack: %s", err)
2363
-			return err
2364
-		}
2365
-	}
2366
-	// TODO(vishh): Enable tty size monitoring once the daemon can support that.
2367
-	if errCh != nil {
2368
-		if err := <-errCh; err != nil {
2369
-			log.Debugf("Error hijack: %s", err)
2370
-			return err
2371
-		}
2372
-	}
2373
-
2374
-	return nil
2375
-}
2376 2302
deleted file mode 100644
... ...
@@ -1,29 +0,0 @@
1
-% DOCKER(1) Docker User Manuals
2
-% Docker Community
3
-% SEPT 2014
4
-# NAME
5
-docker-exec - Run a command in an existing container
6
-
7
-# SYNOPSIS
8
-**docker exec**
9
-[**-d**|**--detach**[=*false*]]
10
-[**-i**|**--interactive**[=*false*]]
11
-[**-t**|**--tty**[=*false*]]
12
- CONTAINER COMMAND [ARG...]
13
-
14
-# DESCRIPTION
15
-
16
-Run a process in an existing container. The existing CONTAINER needs is active.
17
-
18
-# Options
19
-
20
-**-d**, **--detach**=*true*|*false*
21
-   Detached mode. This runs the new process in the background.
22
-
23
-**-i**, **--interactive**=*true*|*false*
24
-   When set to true, keep stdin open even if not attached. The default is false.
25
-
26
-**-t**, **--tty**=*true*|*false*
27
-   When set to true Docker can allocate a pseudo-tty and attach to the standard
28
-input of the process. This can be used, for example, to run a throwaway
29
-interactive shell. The default is value is false.
... ...
@@ -1295,37 +1295,6 @@ It is even useful to cherry-pick particular tags of an image repository
1295 1295
 
1296 1296
    $ sudo docker save -o ubuntu.tar ubuntu:lucid ubuntu:saucy
1297 1297
 
1298
-## exec
1299
-
1300
-    Usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
1301
-
1302
-    Run a command in an existing container
1303
-
1304
-      -d, --detach=false         Detached mode: run the process in the background and exit
1305
-      -i, --interactive=false    Keep STDIN open even if not attached
1306
-      -t, --tty=false            Allocate a pseudo-TTY
1307
-
1308
-The `docker exec` command runs a user specified command as a new process in an existing
1309
-user specified container. The container needs to be active.
1310
-
1311
-The `docker exec` command will typically be used after `docker run`.
1312
-
1313
-### Examples:
1314
-
1315
-    $ sudo docker run --name ubuntu_bash --rm -i -t ubuntu bash
1316
-
1317
-This will create a container named 'ubuntu_bash' and start a bash session.
1318
-
1319
-    $ sudo docker exec -d ubuntu_bash touch /tmp/execWorks
1320
-
1321
-This will create a new file '/tmp/execWorks' inside the existing and active container
1322
-'ubuntu_bash', in the background.
1323
-
1324
-    $ sudo docker exec ubuntu_bash -it bash
1325
-
1326
-This will create a new bash session in the container 'ubuntu_bash'.
1327
-
1328
-
1329 1298
 ## search
1330 1299
 
1331 1300
 Search [Docker Hub](https://hub.docker.com) for images