Browse code

Update cli.md to include 'docker exec' feature. Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)

Vishnu Kannan authored on 2014/09/10 16:39:20
Showing 1 changed files
... ...
@@ -1295,6 +1295,36 @@ 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 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
+
1298 1328
 
1299 1329
 ## search
1300 1330