Browse code

Improved "start a container" section in 1.16 & 1.17 docs

It seems it was lost or something

Signed-off-by: Kirill Sibirev <l0kix2@gmail.com>

Kirill SIbirev authored on 2015/04/03 21:54:01
Showing 2 changed files
... ...
@@ -509,12 +509,66 @@ Start the container `id`
509 509
         POST /containers/(id)/start HTTP/1.1
510 510
         Content-Type: application/json
511 511
 
512
+        {
513
+             "Binds": ["/tmp:/tmp"],
514
+             "Links": ["redis3:redis"],
515
+             "LxcConf": {"lxc.utsname":"docker"},
516
+             "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
517
+             "PublishAllPorts": false,
518
+             "Privileged": false,
519
+             "Dns": ["8.8.8.8"],
520
+             "DnsSearch": [""],
521
+             "VolumesFrom": ["parent", "other:ro"],
522
+             "CapAdd": ["NET_ADMIN"],
523
+             "CapDrop": ["MKNOD"],
524
+             "RestartPolicy": { "Name": "", "MaximumRetryCount": 0 },
525
+             "NetworkMode": "bridge",
526
+             "Devices": []
527
+        }
528
+
512 529
 **Example response**:
513 530
 
514 531
         HTTP/1.1 204 No Content
515 532
 
516 533
 Json Parameters:
517 534
 
535
+-   **Binds** – A list of volume bindings for this container.  Each volume
536
+        binding is a string of the form `container_path` (to create a new
537
+        volume for the container), `host_path:container_path` (to bind-mount
538
+        a host path into the container), or `host_path:container_path:ro`
539
+        (to make the bind-mount read-only inside the container).
540
+-   **Links** - A list of links for the container.  Each link entry should be of
541
+      of the form "container_name:alias".
542
+-   **LxcConf** - LXC specific configurations.  These configurations will only
543
+      work when using the `lxc` execution driver.
544
+-   **PortBindings** - A map of exposed container ports and the host port they
545
+      should map to. It should be specified in the form
546
+      `{ <port>/<protocol>: [{ "HostPort": "<port>" }] }`
547
+      Take note that `port` is specified as a string and not an integer value.
548
+-   **PublishAllPorts** - Allocates a random host port for all of a container's
549
+      exposed ports. Specified as a boolean value.
550
+-   **Privileged** - Gives the container full access to the host.  Specified as
551
+      a boolean value.
552
+-   **Dns** - A list of dns servers for the container to use.
553
+-   **DnsSearch** - A list of DNS search domains
554
+-   **VolumesFrom** - A list of volumes to inherit from another container.
555
+      Specified in the form `<container name>[:<ro|rw>]`
556
+-   **CapAdd** - A list of kernel capabilties to add to the container.
557
+-   **Capdrop** - A list of kernel capabilties to drop from the container.
558
+-   **RestartPolicy** – The behavior to apply when the container exits.  The
559
+        value is an object with a `Name` property of either `"always"` to
560
+        always restart or `"on-failure"` to restart only when the container
561
+        exit code is non-zero.  If `on-failure` is used, `MaximumRetryCount`
562
+        controls the number of times to retry before giving up.
563
+        The default is not to restart. (optional)
564
+        An ever increasing delay (double the previous delay, starting at 100mS)
565
+        is added before each restart to prevent flooding the server.
566
+-   **NetworkMode** - Sets the networking mode for the container. Supported
567
+      values are: `bridge`, `host`, and `container:<name|id>`
568
+-   **Devices** - A list of devices to add to the container specified in the
569
+      form
570
+      `{ "PathOnHost": "/dev/deviceName", "PathInContainer": "/dev/deviceName", "CgroupPermissions": "mrw"}`
571
+
518 572
 Status Codes:
519 573
 
520 574
 -   **204** – no error
... ...
@@ -639,12 +639,69 @@ Start the container `id`
639 639
         POST /containers/(id)/start HTTP/1.1
640 640
         Content-Type: application/json
641 641
 
642
+        {
643
+             "Binds": ["/tmp:/tmp"],
644
+             "Links": ["redis3:redis"],
645
+             "LxcConf": {"lxc.utsname":"docker"},
646
+             "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
647
+             "PublishAllPorts": false,
648
+             "Privileged": false,
649
+             "ReadonlyRootfs": false,
650
+             "Dns": ["8.8.8.8"],
651
+             "DnsSearch": [""],
652
+             "VolumesFrom": ["parent", "other:ro"],
653
+             "CapAdd": ["NET_ADMIN"],
654
+             "CapDrop": ["MKNOD"],
655
+             "RestartPolicy": { "Name": "", "MaximumRetryCount": 0 },
656
+             "NetworkMode": "bridge",
657
+             "Devices": []
658
+        }
659
+
642 660
 **Example response**:
643 661
 
644 662
         HTTP/1.1 204 No Content
645 663
 
646 664
 Json Parameters:
647 665
 
666
+-   **Binds** – A list of volume bindings for this container.  Each volume
667
+        binding is a string of the form `container_path` (to create a new
668
+        volume for the container), `host_path:container_path` (to bind-mount
669
+        a host path into the container), or `host_path:container_path:ro`
670
+        (to make the bind-mount read-only inside the container).
671
+-   **Links** - A list of links for the container.  Each link entry should be of
672
+      of the form "container_name:alias".
673
+-   **LxcConf** - LXC specific configurations.  These configurations will only
674
+      work when using the `lxc` execution driver.
675
+-   **PortBindings** - A map of exposed container ports and the host port they
676
+      should map to. It should be specified in the form
677
+      `{ <port>/<protocol>: [{ "HostPort": "<port>" }] }`
678
+      Take note that `port` is specified as a string and not an integer value.
679
+-   **PublishAllPorts** - Allocates a random host port for all of a container's
680
+      exposed ports. Specified as a boolean value.
681
+-   **Privileged** - Gives the container full access to the host.  Specified as
682
+      a boolean value.
683
+-   **ReadonlyRootfs** - Mount the container's root filesystem as read only.
684
+      Specified as a boolean value.
685
+-   **Dns** - A list of dns servers for the container to use.
686
+-   **DnsSearch** - A list of DNS search domains
687
+-   **VolumesFrom** - A list of volumes to inherit from another container.
688
+      Specified in the form `<container name>[:<ro|rw>]`
689
+-   **CapAdd** - A list of kernel capabilties to add to the container.
690
+-   **Capdrop** - A list of kernel capabilties to drop from the container.
691
+-   **RestartPolicy** – The behavior to apply when the container exits.  The
692
+        value is an object with a `Name` property of either `"always"` to
693
+        always restart or `"on-failure"` to restart only when the container
694
+        exit code is non-zero.  If `on-failure` is used, `MaximumRetryCount`
695
+        controls the number of times to retry before giving up.
696
+        The default is not to restart. (optional)
697
+        An ever increasing delay (double the previous delay, starting at 100mS)
698
+        is added before each restart to prevent flooding the server.
699
+-   **NetworkMode** - Sets the networking mode for the container. Supported
700
+      values are: `bridge`, `host`, and `container:<name|id>`
701
+-   **Devices** - A list of devices to add to the container specified in the
702
+      form
703
+      `{ "PathOnHost": "/dev/deviceName", "PathInContainer": "/dev/deviceName", "CgroupPermissions": "mrw"}`
704
+
648 705
 Status Codes:
649 706
 
650 707
 -   **204** – no error