Browse code

Add swarm api reference docs

Signed-off-by: Arnaud Porterie (icecrime) <arnaud.porterie@docker.com>

Arnaud Porterie (icecrime) authored on 2016/06/14 11:55:02
Showing 1 changed files
... ...
@@ -492,7 +492,6 @@ Status Codes:
492 492
 
493 493
 Return low-level information on the container `id`
494 494
 
495
-
496 495
 **Example request**:
497 496
 
498 497
       GET /containers/4fa6e0f0c678/json HTTP/1.1
... ...
@@ -3306,6 +3305,1119 @@ Status Codes
3306 3306
 -   **404** - no such network
3307 3307
 -   **500** - server error
3308 3308
 
3309
+## 3.6 Nodes
3310
+
3311
+**Note:** Nodes operations require to first be part of a Swarm.
3312
+
3313
+### List nodes
3314
+
3315
+**Warning:** this endpoint is part of the Swarm management feature introduced in Docker 1.12, and
3316
+might be subject to non backward-compatible changes.
3317
+
3318
+`GET /nodes`
3319
+
3320
+List nodes
3321
+
3322
+**Example request**:
3323
+
3324
+    GET /nodes HTTP/1.1
3325
+
3326
+**Example response**:
3327
+
3328
+    HTTP/1.1 200 OK
3329
+    Content-Type: application/json
3330
+
3331
+    [
3332
+      {
3333
+        "ID": "24ifsmvkjbyhk",
3334
+        "Version": {
3335
+          "Index": 8
3336
+        },
3337
+        "CreatedAt": "2016-06-07T20:31:11.853781916Z",
3338
+        "UpdatedAt": "2016-06-07T20:31:11.999868824Z",
3339
+        "Spec": {
3340
+          "Role": "MANAGER",
3341
+          "Membership": "ACCEPTED",
3342
+          "Availability": "ACTIVE"
3343
+        },
3344
+        "Description": {
3345
+          "Hostname": "bf3067039e47",
3346
+          "Platform": {
3347
+            "Architecture": "x86_64",
3348
+            "OS": "linux"
3349
+          },
3350
+          "Resources": {
3351
+            "NanoCPUs": 4000000000,
3352
+            "MemoryBytes": 8272408576
3353
+          },
3354
+          "Engine": {
3355
+            "EngineVersion": "1.12.0-dev",
3356
+            "Plugins": [
3357
+              {
3358
+                "Type": "Volume",
3359
+                "Name": "local"
3360
+              },
3361
+              {
3362
+                "Type": "Network",
3363
+                "Name": "overlay"
3364
+              }
3365
+            ]
3366
+          }
3367
+        },
3368
+        "Status": {
3369
+          "State": "READY"
3370
+        },
3371
+        "Manager": {
3372
+          "Raft": {
3373
+            "RaftID": 10070664527094528000,
3374
+            "Addr": "172.17.0.2:4500",
3375
+            "Status": {
3376
+              "Leader": true,
3377
+              "Reachability": "REACHABLE"
3378
+            }
3379
+          }
3380
+        },
3381
+        "Attachment": {
3382
+          "Network": {
3383
+            "ID": "4qvuz4ko70xaltuqbt8956gd1",
3384
+            "Version": {
3385
+              "Index": 6
3386
+            },
3387
+            "CreatedAt": "2016-06-07T20:31:11.912919752Z",
3388
+            "UpdatedAt": "2016-06-07T20:31:11.921784144Z",
3389
+            "Spec": {
3390
+              "Name": "ingress",
3391
+              "Labels": {
3392
+                "com.docker.swarm.internal": "true"
3393
+              },
3394
+              "DriverConfiguration": {},
3395
+              "IPAM": {
3396
+                "Driver": {},
3397
+                "Configs": [
3398
+                  {
3399
+                    "Family": "UNKNOWN",
3400
+                    "Subnet": "10.255.0.0/16"
3401
+                  }
3402
+                ]
3403
+              }
3404
+            },
3405
+            "DriverState": {
3406
+              "Name": "overlay",
3407
+              "Options": {
3408
+                "com.docker.network.driver.overlay.vxlanid_list": "256"
3409
+              }
3410
+            },
3411
+            "IPAM": {
3412
+              "Driver": {
3413
+                "Name": "default"
3414
+              },
3415
+              "Configs": [
3416
+                {
3417
+                  "Family": "UNKNOWN",
3418
+                  "Subnet": "10.255.0.0/16"
3419
+                }
3420
+              ]
3421
+            }
3422
+          },
3423
+          "Addresses": [
3424
+            "10.255.0.2/16"
3425
+          ]
3426
+        }
3427
+      }
3428
+    ]
3429
+
3430
+Query Parameters:
3431
+
3432
+- **filters** – a JSON encoded value of the filters (a `map[string][]string`) to process on the
3433
+  nodes list. Available filters:
3434
+  - `id=<node id>`
3435
+  - `name=<node name>`
3436
+  - `membership=`(`pending`|`accepted`|`rejected`)`
3437
+  - `role=`(`worker`|`manager`)`
3438
+
3439
+Status Codes:
3440
+
3441
+- **200** – no error
3442
+- **500** – server error
3443
+
3444
+### Inspect a node
3445
+
3446
+**Warning:** this endpoint is part of the Swarm management feature introduced in Docker 1.12, and
3447
+might be subject to non backward-compatible changes.
3448
+
3449
+`GET /nodes/<id>`
3450
+
3451
+Return low-level information on the node `id`
3452
+
3453
+**Example request**:
3454
+
3455
+      GET /node/24ifsmvkjbyhk HTTP/1.1
3456
+
3457
+**Example response**:
3458
+
3459
+    HTTP/1.1 200 OK
3460
+    Content-Type: application/json
3461
+
3462
+    {
3463
+      "ID": "24ifsmvkjbyhk",
3464
+      "Version": {
3465
+        "Index": 8
3466
+      },
3467
+      "CreatedAt": "2016-06-07T20:31:11.853781916Z",
3468
+      "UpdatedAt": "2016-06-07T20:31:11.999868824Z",
3469
+      "Spec": {
3470
+        "Role": "MANAGER",
3471
+        "Membership": "ACCEPTED",
3472
+        "Availability": "ACTIVE"
3473
+      },
3474
+      "Description": {
3475
+        "Hostname": "bf3067039e47",
3476
+        "Platform": {
3477
+          "Architecture": "x86_64",
3478
+          "OS": "linux"
3479
+        },
3480
+        "Resources": {
3481
+          "NanoCPUs": 4000000000,
3482
+          "MemoryBytes": 8272408576
3483
+        },
3484
+        "Engine": {
3485
+          "EngineVersion": "1.12.0-dev",
3486
+          "Plugins": [
3487
+            {
3488
+              "Type": "Volume",
3489
+              "Name": "local"
3490
+            },
3491
+            {
3492
+              "Type": "Network",
3493
+              "Name": "overlay"
3494
+            }
3495
+          ]
3496
+        }
3497
+      },
3498
+      "Status": {
3499
+        "State": "READY"
3500
+      },
3501
+      "Manager": {
3502
+        "Raft": {
3503
+          "RaftID": 10070664527094528000,
3504
+          "Addr": "172.17.0.2:4500",
3505
+          "Status": {
3506
+            "Leader": true,
3507
+            "Reachability": "REACHABLE"
3508
+          }
3509
+        }
3510
+      },
3511
+      "Attachment": {
3512
+        "Network": {
3513
+          "ID": "4qvuz4ko70xaltuqbt8956gd1",
3514
+          "Version": {
3515
+            "Index": 6
3516
+          },
3517
+          "CreatedAt": "2016-06-07T20:31:11.912919752Z",
3518
+          "UpdatedAt": "2016-06-07T20:31:11.921784144Z",
3519
+          "Spec": {
3520
+            "Name": "ingress",
3521
+            "Labels": {
3522
+              "com.docker.swarm.internal": "true"
3523
+            },
3524
+            "DriverConfiguration": {},
3525
+            "IPAM": {
3526
+              "Driver": {},
3527
+              "Configs": [
3528
+                {
3529
+                  "Family": "UNKNOWN",
3530
+                  "Subnet": "10.255.0.0/16"
3531
+                }
3532
+              ]
3533
+            }
3534
+          },
3535
+          "DriverState": {
3536
+            "Name": "overlay",
3537
+            "Options": {
3538
+              "com.docker.network.driver.overlay.vxlanid_list": "256"
3539
+            }
3540
+          },
3541
+          "IPAM": {
3542
+            "Driver": {
3543
+              "Name": "default"
3544
+            },
3545
+            "Configs": [
3546
+              {
3547
+                "Family": "UNKNOWN",
3548
+                "Subnet": "10.255.0.0/16"
3549
+              }
3550
+            ]
3551
+          }
3552
+        },
3553
+        "Addresses": [
3554
+          "10.255.0.2/16"
3555
+        ]
3556
+      }
3557
+    }
3558
+
3559
+Status Codes:
3560
+
3561
+-   **200** – no error
3562
+-   **404** – no such node
3563
+-   **500** – server error
3564
+
3565
+## 3.7 Swarm
3566
+
3567
+### Initialize a new Swarm
3568
+
3569
+**Warning:** this endpoint is part of the Swarm management feature introduced in Docker 1.12, and
3570
+might be subject to non backward-compatible changes.
3571
+
3572
+`POST /swarm/init`
3573
+
3574
+Initialize a new Swarm
3575
+
3576
+**Example request**:
3577
+
3578
+    POST /swarm/init HTTP/1.1
3579
+    Content-Type: application/json
3580
+
3581
+    {
3582
+      "ListenAddr": "0.0.0.0:4500",
3583
+      "ForceNewCluster": false,
3584
+      "Spec": {
3585
+        "AcceptancePolicy": {
3586
+          "Policies": [
3587
+            {
3588
+              "Role": "MANAGER",
3589
+              "Autoaccept": false
3590
+            },
3591
+            {
3592
+              "Role": "WORKER",
3593
+              "Autoaccept": true
3594
+            }
3595
+          ]
3596
+        },
3597
+        "Orchestration": {},
3598
+        "Raft": {},
3599
+        "Dispatcher": {},
3600
+        "CAConfig": {}
3601
+      }
3602
+    }
3603
+
3604
+**Example response**:
3605
+
3606
+    HTTP/1.1 200 OK
3607
+    Content-Length: 0
3608
+    Content-Type: text/plain; charset=utf-8
3609
+
3610
+Status Codes:
3611
+
3612
+- **200** – no error
3613
+- **400** – bad parameter
3614
+- **500** – server error or node is already part of a Swarm
3615
+
3616
+JSON Parameters:
3617
+
3618
+- **ListenAddr** – Listen address used for inter-manager communication, as well as determining.
3619
+  the networking interface used for the VXLAN Tunnel Endpoint (VTEP).
3620
+- **ForceNewCluster** – Force creating a new Swarm even if already part of one.
3621
+- **Spec** – Configuration settings of the new Swarm.
3622
+    - **Policies** – An array of acceptance policies.
3623
+        - **Role** – The role that policy applies to (`MANAGER` or `WORKER`)
3624
+        - **Autoaccept** – A boolean indicating whether nodes joining for that role should be
3625
+          automatically accepted in the Swarm.
3626
+        - **Secret** – An optional secret to provide for nodes to join the Swarm.
3627
+    - **Orchestration** – Configuration settings for the orchestration aspects of the Swarm.
3628
+        - **TaskHistoryRetentionLimit** – Maximum number of tasks history stored.
3629
+    - **RaftConfig** – Raft related configuration.
3630
+        - **SnapshotInterval** – (TODO)
3631
+        - **KeepOldSnapshots** – (TODO)
3632
+        - **LogEntriesForSlowFollowers** – (TODO)
3633
+        - **HeartbeatTick** – (TODO)
3634
+        - **ElectionTick** – (TODO)
3635
+    - **DispatcherConfig** – Configuration settings for the task dispatcher.
3636
+        - **HeartbeatPeriod** – (TODO)
3637
+    - **CAConfig** – CA configuration.
3638
+        - **NodeCertExpiry** – Automatic expiry for nodes certificates.
3639
+
3640
+### Join an existing Swarm
3641
+
3642
+**Warning:** this endpoint is part of the Swarm management feature introduced in Docker 1.12, and
3643
+might be subject to non backward-compatible changes.
3644
+
3645
+`POST /swarm/join`
3646
+
3647
+Join an existing new Swarm
3648
+
3649
+**Example request**:
3650
+
3651
+    POST /swarm/join HTTP/1.1
3652
+    Content-Type: application/json
3653
+
3654
+    {
3655
+      "ListenAddr": "0.0.0.0:4500",
3656
+      "RemoteAddr": "node1:4500",
3657
+      "Secret": "",
3658
+      "CAHash": "",
3659
+      "Manager": false
3660
+    }
3661
+
3662
+**Example response**:
3663
+
3664
+    HTTP/1.1 200 OK
3665
+    Content-Length: 0
3666
+    Content-Type: text/plain; charset=utf-8
3667
+
3668
+Status Codes:
3669
+
3670
+- **200** – no error
3671
+- **400** – bad parameter
3672
+- **500** – server error or node is already part of a Swarm
3673
+
3674
+JSON Parameters:
3675
+
3676
+- **ListenAddr** – Listen address used for inter-manager communication if the node gets promoted to
3677
+  manager, as well as determining the networking interface used for the VXLAN Tunnel Endpoint (VTEP).
3678
+- **RemoteAddr** – Address of any manager node already participating in the Swarm to join.
3679
+- **Secret** – Secret token for joining this Swarm.
3680
+- **CAHash** – Optional hash of the root CA to avoid relying on trust on first use.
3681
+- **Manager** – Directly join as a manager (only for a Swarm configured to autoaccept managers).
3682
+
3683
+### Leave a Swarm
3684
+
3685
+**Warning:** this endpoint is part of the Swarm management feature introduced in Docker 1.12, and
3686
+might be subject to non backward-compatible changes.
3687
+
3688
+`POST /swarm/leave`
3689
+
3690
+Leave a Swarm
3691
+
3692
+**Example request**:
3693
+
3694
+    POST /swarm/leave HTTP/1.1
3695
+
3696
+**Example response**:
3697
+
3698
+    HTTP/1.1 200 OK
3699
+    Content-Length: 0
3700
+    Content-Type: text/plain; charset=utf-8
3701
+
3702
+Status Codes:
3703
+
3704
+- **200** – no error
3705
+- **500** – server error or node is not part of a Swarm
3706
+
3707
+### Update a Swarm
3708
+
3709
+**Warning:** this endpoint is part of the Swarm management feature introduced in Docker 1.12, and
3710
+might be subject to non backward-compatible changes.
3711
+
3712
+`POST /swarm/update`
3713
+
3714
+Update a Swarm
3715
+
3716
+**Example request**:
3717
+
3718
+    POST /swarm/update HTTP/1.1
3719
+
3720
+    (TODO)
3721
+
3722
+**Example response**:
3723
+
3724
+    HTTP/1.1 200 OK
3725
+    Content-Length: 0
3726
+    Content-Type: text/plain; charset=utf-8
3727
+
3728
+    (TODO)
3729
+
3730
+Status Codes:
3731
+
3732
+- **200** – no error
3733
+- **400** – bad parameter
3734
+- **500** – server error or node is not part of a Swarm
3735
+
3736
+## 3.8 Services
3737
+
3738
+**Note:** Service operations require to first be part of a Swarm.
3739
+
3740
+### List services
3741
+
3742
+**Warning:** this endpoint is part of the Swarm management feature introduced in Docker 1.12, and
3743
+might be subject to non backward-compatible changes.
3744
+
3745
+`GET /services`
3746
+
3747
+List services
3748
+
3749
+**Example request**:
3750
+
3751
+    GET /services HTTP/1.1
3752
+
3753
+**Example response**:
3754
+
3755
+    HTTP/1.1 200 OK
3756
+    Content-Type: application/json
3757
+
3758
+    [
3759
+      {
3760
+        "ID": "9mnpnzenvg8p8tdbtq4wvbkcz",
3761
+        "Version": {
3762
+          "Index": 19
3763
+        },
3764
+        "CreatedAt": "2016-06-07T21:05:51.880065305Z",
3765
+        "UpdatedAt": "2016-06-07T21:07:29.962229872Z",
3766
+        "Spec": {
3767
+          "Name": "hopeful_cori",
3768
+          "Task": {
3769
+            "ContainerSpec": {
3770
+              "Image": "redis"
3771
+            },
3772
+            "Resources": {
3773
+              "Limits": {},
3774
+              "Reservations": {}
3775
+            },
3776
+            "RestartPolicy": {
3777
+              "Condition": "ANY"
3778
+            },
3779
+            "Placement": {}
3780
+          },
3781
+          "Mode": {
3782
+            "Replicated": {
3783
+              "Instances": 1
3784
+            }
3785
+          },
3786
+          "UpdateConfig": {
3787
+            "Parallelism": 1
3788
+          },
3789
+          "EndpointSpec": {
3790
+            "Mode": "VIP",
3791
+            "Ingress": "PUBLICPORT",
3792
+            "ExposedPorts": [
3793
+              {
3794
+                "Protocol": "tcp",
3795
+                "Port": 6379
3796
+              }
3797
+            ]
3798
+          }
3799
+        },
3800
+        "Endpoint": {
3801
+          "Spec": {},
3802
+          "ExposedPorts": [
3803
+            {
3804
+              "Protocol": "tcp",
3805
+              "Port": 6379,
3806
+              "PublicPort": 30000
3807
+            }
3808
+          ],
3809
+          "VirtualIPs": [
3810
+            {
3811
+              "NetworkID": "4qvuz4ko70xaltuqbt8956gd1",
3812
+              "Addr": "10.255.0.2/16"
3813
+            },
3814
+            {
3815
+              "NetworkID": "4qvuz4ko70xaltuqbt8956gd1",
3816
+              "Addr": "10.255.0.3/16"
3817
+            }
3818
+          ]
3819
+        }
3820
+      }
3821
+    ]
3822
+
3823
+Query Parameters:
3824
+
3825
+- **filters** – a JSON encoded value of the filters (a `map[string][]string`) to process on the
3826
+  services list. Available filters:
3827
+  - `id=<node id>`
3828
+  - `name=<node name>`
3829
+
3830
+Status Codes:
3831
+
3832
+- **200** – no error
3833
+- **500** – server error
3834
+
3835
+### Create a service
3836
+
3837
+**Warning:** this endpoint is part of the Swarm management feature introduced in Docker 1.12, and
3838
+might be subject to non backward-compatible changes.
3839
+
3840
+`POST /services/create`
3841
+
3842
+Create a service
3843
+
3844
+**Example request**:
3845
+
3846
+    POST /service/create HTTP/1.1
3847
+    Content-Type: application/json
3848
+
3849
+    {
3850
+      "Name": "redis",
3851
+      "Task": {
3852
+        "ContainerSpec": {
3853
+          "Image": "redis"
3854
+        },
3855
+        "Resources": {
3856
+          "Limits": {},
3857
+          "Reservations": {}
3858
+        },
3859
+        "RestartPolicy": {},
3860
+        "Placement": {}
3861
+      },
3862
+      "Mode": {
3863
+        "Replicated": {
3864
+          "Instances": 1
3865
+        }
3866
+      },
3867
+      "UpdateConfig": {
3868
+        "Parallelism": 1
3869
+      },
3870
+      "EndpointSpec": {
3871
+        "ExposedPorts": [
3872
+          {
3873
+            "Protocol": "tcp",
3874
+            "Port": 6379
3875
+          }
3876
+        ]
3877
+      }
3878
+    }
3879
+
3880
+**Example response**:
3881
+
3882
+    HTTP/1.1 201 Created
3883
+    Content-Type: application/json
3884
+
3885
+    {
3886
+      "Id":"ak7w3gjqoa3kuz8xcpnyy0pvl"
3887
+    }
3888
+
3889
+Status Codes:
3890
+
3891
+- **201** – no error
3892
+- **500** – server error or node is not part of a Swarm
3893
+
3894
+JSON Parameters:
3895
+
3896
+- **Annotations** – Optional medata to associate with the service.
3897
+    - **Name** – User-defined name for the service.
3898
+    - **Labels** – A map of labels to associate with the service (e.g.,
3899
+      `{"key":"value"[,"key2":"value2"]}`).
3900
+- **Task** – Specification of the tasks to start as part of the new service.
3901
+    - **ContainerSpec** - Container settings for containers started as part of this task.
3902
+        - **Image** – A string specifying the image name to use for the container.
3903
+        - **Command** – The command to be run in the image.
3904
+        - **Args** – Arguments to the command.
3905
+        - **Env** – A list of environment variables in the form of `["VAR=value"[,"VAR2=value2"]]`.
3906
+        - **Dir** – A string specifying the working directory for commands to run in.
3907
+        - **User** – A string value specifying the user inside the container.
3908
+        - **Labels** – A map of labels to associate with the service (e.g.,
3909
+          `{"key":"value"[,"key2":"value2"]}`).
3910
+        - **Mounts** – Specification for mounts to be added to containers created as part of the new
3911
+          service.
3912
+            - **Target** – Container path.
3913
+            - **Source** – Optional host path to be mounted in the target.
3914
+            - **Type** – The mount type (`bind`, `epheremal`, or `volume`).
3915
+            - **VolumeName** – A name for the volume.
3916
+            - **Populate** – A boolean indicating if volume should be populated with the data form the
3917
+              target (defaults to false).
3918
+            - **Propagation** – A propagation mode with the value `[r]private`, `[r]shared`, or
3919
+              `[r]slave` (`bind` type mounts only).
3920
+            - **MCSAccessMode** – MCS label for sharing mode (`bind` type mounts only).
3921
+            - **Writable** – A boolean indicating whether the mount should be writable.
3922
+            - **VolumeTemplate** – Optional configuration for the volume.
3923
+                - **Annotations** – User-defined name and labels for the volume.
3924
+                - **Driver** – Name of the driver to be used and driver-specific options.
3925
+        - **StopGracePeriod** – Amount of time to wait for the container to terminate before
3926
+          forcefully killing it.
3927
+    - **Resources** – Resource requirements which apply to each individual container created as part
3928
+      of the service.
3929
+        - **Limits** – Define resources limits.
3930
+            - **CPU** – CPU limit
3931
+            - **Memory** – Memory limit
3932
+        - **Reservation** – Define resources reservation.
3933
+            - **CPU** – CPU reservation
3934
+            - **Memory** – Memory reservation
3935
+    - **RestartPolicy** – Specification for the restart policy which applies to containers created
3936
+      as part of this service.
3937
+        - **Condition** – Condition for restart (`none`, `on_failure`, or `any`).
3938
+        - **Delay** – Delay between restart attempts.
3939
+        - **Attempts** – Maximum attempts to restart a given container before giving up (default value
3940
+          is 0, which is ignored).
3941
+        - **Window** – Windows is the time window used to evaluate the restart policy (default value is
3942
+          0, which is unbounded).
3943
+    - **Placement** – An array of constraints.
3944
+- **Mode** – Scheduling mode for the service (`replicated` or `global`, defaults to `replicated`).
3945
+- **UpdateConfig** – Specification for the update strategy of the service.
3946
+    - **Parallelism** – Maximum number of tasks to be updated in one iteration (0 means unlimited
3947
+      parallelism).
3948
+    - **Delay** – Amount of time between updates.
3949
+- **Networks** – Array of network names or IDs to attach the service to.
3950
+- **EndpointSpec** – (TODO)
3951
+    - **EndpointSpecStrategy** – `network` or `disabled` (TODO)
3952
+    - **ExposedPorts** – An object mapping ports to an empty object in the form of:
3953
+      `"ExposedPorts": { "<port>/<tcp|udp>: {}" }`
3954
+
3955
+### Remove a service
3956
+
3957
+**Warning:** this endpoint is part of the Swarm management feature introduced in Docker 1.12, and
3958
+might be subject to non backward-compatible changes.
3959
+
3960
+`DELETE /service/(id or name)`
3961
+
3962
+Stop and remove the service `id`
3963
+
3964
+**Example request**:
3965
+
3966
+    DELETE /service/16253994b7c4 HTTP/1.1
3967
+
3968
+**Example response**:
3969
+
3970
+    HTTP/1.1 204 No Content
3971
+
3972
+Status Codes:
3973
+
3974
+-   **204** – no error
3975
+-   **404** – no such service
3976
+-   **500** – server error
3977
+
3978
+### Inspect a service
3979
+
3980
+**Warning:** this endpoint is part of the Swarm management feature introduced in Docker 1.12, and
3981
+might be subject to non backward-compatible changes.
3982
+
3983
+`GET /service/(id or name)`
3984
+
3985
+Return information on the service `id`.
3986
+
3987
+**Example request**:
3988
+
3989
+    GET /service/1cb4dnqcyx6m66g2t538x3rxha HTTP/1.1
3990
+
3991
+**Example response**:
3992
+
3993
+    {
3994
+      "ID": "ak7w3gjqoa3kuz8xcpnyy0pvl",
3995
+      "Version": {
3996
+        "Index": 95
3997
+      },
3998
+      "CreatedAt": "2016-06-07T21:10:20.269723157Z",
3999
+      "UpdatedAt": "2016-06-07T21:10:20.276301259Z",
4000
+      "Spec": {
4001
+        "Name": "redis",
4002
+        "Task": {
4003
+          "ContainerSpec": {
4004
+            "Image": "redis"
4005
+          },
4006
+          "Resources": {
4007
+            "Limits": {},
4008
+            "Reservations": {}
4009
+          },
4010
+          "RestartPolicy": {
4011
+            "Condition": "ANY"
4012
+          },
4013
+          "Placement": {}
4014
+        },
4015
+        "Mode": {
4016
+          "Replicated": {
4017
+            "Instances": 1
4018
+          }
4019
+        },
4020
+        "UpdateConfig": {
4021
+          "Parallelism": 1
4022
+        },
4023
+        "EndpointSpec": {
4024
+          "Mode": "VIP",
4025
+          "Ingress": "PUBLICPORT",
4026
+          "ExposedPorts": [
4027
+            {
4028
+              "Protocol": "tcp",
4029
+              "Port": 6379
4030
+            }
4031
+          ]
4032
+        }
4033
+      },
4034
+      "Endpoint": {
4035
+        "Spec": {},
4036
+        "ExposedPorts": [
4037
+          {
4038
+            "Protocol": "tcp",
4039
+            "Port": 6379,
4040
+            "PublicPort": 30001
4041
+          }
4042
+        ],
4043
+        "VirtualIPs": [
4044
+          {
4045
+            "NetworkID": "4qvuz4ko70xaltuqbt8956gd1",
4046
+            "Addr": "10.255.0.4/16"
4047
+          }
4048
+        ]
4049
+      }
4050
+    }
4051
+
4052
+Status Codes:
4053
+
4054
+-   **200** – no error
4055
+-   **404** – no such service
4056
+-   **500** – server error
4057
+
4058
+### Update a service
4059
+
4060
+(TODO)
4061
+
4062
+## 3.9 Tasks
4063
+
4064
+**Note:** Tasks operations require to first be part of a Swarm.
4065
+
4066
+### List tasks
4067
+
4068
+**Warning:** this endpoint is part of the Swarm management feature introduced in Docker 1.12, and
4069
+might be subject to non backward-compatible changes.
4070
+
4071
+`GET /tasks`
4072
+
4073
+List tasks
4074
+
4075
+**Example request**:
4076
+
4077
+    GET /tasks HTTP/1.1
4078
+
4079
+**Example response**:
4080
+
4081
+    [
4082
+      {
4083
+        "ID": "0kzzo1i0y4jz6027t0k7aezc7",
4084
+        "Version": {
4085
+          "Index": 71
4086
+        },
4087
+        "CreatedAt": "2016-06-07T21:07:31.171892745Z",
4088
+        "UpdatedAt": "2016-06-07T21:07:31.376370513Z",
4089
+        "Name": "hopeful_cori",
4090
+        "Spec": {
4091
+          "ContainerSpec": {
4092
+            "Image": "redis"
4093
+          },
4094
+          "Resources": {
4095
+            "Limits": {},
4096
+            "Reservations": {}
4097
+          },
4098
+          "RestartPolicy": {
4099
+            "Condition": "ANY"
4100
+          },
4101
+          "Placement": {}
4102
+        },
4103
+        "ServiceID": "9mnpnzenvg8p8tdbtq4wvbkcz",
4104
+        "Instance": 1,
4105
+        "NodeID": "24ifsmvkjbyhk",
4106
+        "ServiceAnnotations": {},
4107
+        "Status": {
4108
+          "Timestamp": "2016-06-07T21:07:31.290032978Z",
4109
+          "State": "FAILED",
4110
+          "Message": "execution failed",
4111
+          "ContainerStatus": {}
4112
+        },
4113
+        "DesiredState": "SHUTDOWN",
4114
+        "NetworksAttachments": [
4115
+          {
4116
+            "Network": {
4117
+              "ID": "4qvuz4ko70xaltuqbt8956gd1",
4118
+              "Version": {
4119
+                "Index": 18
4120
+              },
4121
+              "CreatedAt": "2016-06-07T20:31:11.912919752Z",
4122
+              "UpdatedAt": "2016-06-07T21:07:29.955277358Z",
4123
+              "Spec": {
4124
+                "Name": "ingress",
4125
+                "Labels": {
4126
+                  "com.docker.swarm.internal": "true"
4127
+                },
4128
+                "DriverConfiguration": {},
4129
+                "IPAM": {
4130
+                  "Driver": {},
4131
+                  "Configs": [
4132
+                    {
4133
+                      "Family": "UNKNOWN",
4134
+                      "Subnet": "10.255.0.0/16"
4135
+                    }
4136
+                  ]
4137
+                }
4138
+              },
4139
+              "DriverState": {
4140
+                "Name": "overlay",
4141
+                "Options": {
4142
+                  "com.docker.network.driver.overlay.vxlanid_list": "256"
4143
+                }
4144
+              },
4145
+              "IPAM": {
4146
+                "Driver": {
4147
+                  "Name": "default"
4148
+                },
4149
+                "Configs": [
4150
+                  {
4151
+                    "Family": "UNKNOWN",
4152
+                    "Subnet": "10.255.0.0/16"
4153
+                  }
4154
+                ]
4155
+              }
4156
+            },
4157
+            "Addresses": [
4158
+              "10.255.0.10/16"
4159
+            ]
4160
+          }
4161
+        ],
4162
+        "Endpoint": {
4163
+          "Spec": {},
4164
+          "ExposedPorts": [
4165
+            {
4166
+              "Protocol": "tcp",
4167
+              "Port": 6379,
4168
+              "PublicPort": 30000
4169
+            }
4170
+          ],
4171
+          "VirtualIPs": [
4172
+            {
4173
+              "NetworkID": "4qvuz4ko70xaltuqbt8956gd1",
4174
+              "Addr": "10.255.0.2/16"
4175
+            },
4176
+            {
4177
+              "NetworkID": "4qvuz4ko70xaltuqbt8956gd1",
4178
+              "Addr": "10.255.0.3/16"
4179
+            }
4180
+          ]
4181
+        }
4182
+      },
4183
+      {
4184
+        "ID": "1yljwbmlr8er2waf8orvqpwms",
4185
+        "Version": {
4186
+          "Index": 30
4187
+        },
4188
+        "CreatedAt": "2016-06-07T21:07:30.019104782Z",
4189
+        "UpdatedAt": "2016-06-07T21:07:30.231958098Z",
4190
+        "Name": "hopeful_cori",
4191
+        "Spec": {
4192
+          "ContainerSpec": {
4193
+            "Image": "redis"
4194
+          },
4195
+          "Resources": {
4196
+            "Limits": {},
4197
+            "Reservations": {}
4198
+          },
4199
+          "RestartPolicy": {
4200
+            "Condition": "ANY"
4201
+          },
4202
+          "Placement": {}
4203
+        },
4204
+        "ServiceID": "9mnpnzenvg8p8tdbtq4wvbkcz",
4205
+        "Instance": 1,
4206
+        "NodeID": "24ifsmvkjbyhk",
4207
+        "ServiceAnnotations": {},
4208
+        "Status": {
4209
+          "Timestamp": "2016-06-07T21:07:30.202183143Z",
4210
+          "State": "FAILED",
4211
+          "Message": "execution failed",
4212
+          "ContainerStatus": {}
4213
+        },
4214
+        "DesiredState": "SHUTDOWN",
4215
+        "NetworksAttachments": [
4216
+          {
4217
+            "Network": {
4218
+              "ID": "4qvuz4ko70xaltuqbt8956gd1",
4219
+              "Version": {
4220
+                "Index": 18
4221
+              },
4222
+              "CreatedAt": "2016-06-07T20:31:11.912919752Z",
4223
+              "UpdatedAt": "2016-06-07T21:07:29.955277358Z",
4224
+              "Spec": {
4225
+                "Name": "ingress",
4226
+                "Labels": {
4227
+                  "com.docker.swarm.internal": "true"
4228
+                },
4229
+                "DriverConfiguration": {},
4230
+                "IPAM": {
4231
+                  "Driver": {},
4232
+                  "Configs": [
4233
+                    {
4234
+                      "Family": "UNKNOWN",
4235
+                      "Subnet": "10.255.0.0/16"
4236
+                    }
4237
+                  ]
4238
+                }
4239
+              },
4240
+              "DriverState": {
4241
+                "Name": "overlay",
4242
+                "Options": {
4243
+                  "com.docker.network.driver.overlay.vxlanid_list": "256"
4244
+                }
4245
+              },
4246
+              "IPAM": {
4247
+                "Driver": {
4248
+                  "Name": "default"
4249
+                },
4250
+                "Configs": [
4251
+                  {
4252
+                    "Family": "UNKNOWN",
4253
+                    "Subnet": "10.255.0.0/16"
4254
+                  }
4255
+                ]
4256
+              }
4257
+            },
4258
+            "Addresses": [
4259
+              "10.255.0.5/16"
4260
+            ]
4261
+          }
4262
+        ],
4263
+        "Endpoint": {
4264
+          "Spec": {},
4265
+          "ExposedPorts": [
4266
+            {
4267
+              "Protocol": "tcp",
4268
+              "Port": 6379,
4269
+              "PublicPort": 30000
4270
+            }
4271
+          ],
4272
+          "VirtualIPs": [
4273
+            {
4274
+              "NetworkID": "4qvuz4ko70xaltuqbt8956gd1",
4275
+              "Addr": "10.255.0.2/16"
4276
+            },
4277
+            {
4278
+              "NetworkID": "4qvuz4ko70xaltuqbt8956gd1",
4279
+              "Addr": "10.255.0.3/16"
4280
+            }
4281
+          ]
4282
+        }
4283
+      }
4284
+    ]
4285
+
4286
+Query Parameters:
4287
+
4288
+- **filters** – a JSON encoded value of the filters (a `map[string][]string`) to process on the
4289
+  services list. Available filters:
4290
+  - `id=<task id>`
4291
+  - `name=<task name>`
4292
+  - `service=<service name>`
4293
+
4294
+Status Codes:
4295
+
4296
+- **200** – no error
4297
+- **500** – server error
4298
+
4299
+### Inspect a task
4300
+
4301
+**Warning:** this endpoint is part of the Swarm management feature introduced in Docker 1.12, and
4302
+might be subject to non backward-compatible changes.
4303
+
4304
+`GET /tasks/(task id)`
4305
+
4306
+Get details on a task
4307
+
4308
+**Example request**:
4309
+
4310
+    GET /tasks/0kzzo1i0y4jz6027t0k7aezc7 HTTP/1.1
4311
+
4312
+**Example response**:
4313
+
4314
+    {
4315
+      "ID": "0kzzo1i0y4jz6027t0k7aezc7",
4316
+      "Version": {
4317
+        "Index": 71
4318
+      },
4319
+      "CreatedAt": "2016-06-07T21:07:31.171892745Z",
4320
+      "UpdatedAt": "2016-06-07T21:07:31.376370513Z",
4321
+      "Name": "hopeful_cori",
4322
+      "Spec": {
4323
+        "ContainerSpec": {
4324
+          "Image": "redis"
4325
+        },
4326
+        "Resources": {
4327
+          "Limits": {},
4328
+          "Reservations": {}
4329
+        },
4330
+        "RestartPolicy": {
4331
+          "Condition": "ANY"
4332
+        },
4333
+        "Placement": {}
4334
+      },
4335
+      "ServiceID": "9mnpnzenvg8p8tdbtq4wvbkcz",
4336
+      "Instance": 1,
4337
+      "NodeID": "24ifsmvkjbyhk",
4338
+      "ServiceAnnotations": {},
4339
+      "Status": {
4340
+        "Timestamp": "2016-06-07T21:07:31.290032978Z",
4341
+        "State": "FAILED",
4342
+        "Message": "execution failed",
4343
+        "ContainerStatus": {}
4344
+      },
4345
+      "DesiredState": "SHUTDOWN",
4346
+      "NetworksAttachments": [
4347
+        {
4348
+          "Network": {
4349
+            "ID": "4qvuz4ko70xaltuqbt8956gd1",
4350
+            "Version": {
4351
+              "Index": 18
4352
+            },
4353
+            "CreatedAt": "2016-06-07T20:31:11.912919752Z",
4354
+            "UpdatedAt": "2016-06-07T21:07:29.955277358Z",
4355
+            "Spec": {
4356
+              "Name": "ingress",
4357
+              "Labels": {
4358
+                "com.docker.swarm.internal": "true"
4359
+              },
4360
+              "DriverConfiguration": {},
4361
+              "IPAM": {
4362
+                "Driver": {},
4363
+                "Configs": [
4364
+                  {
4365
+                    "Family": "UNKNOWN",
4366
+                    "Subnet": "10.255.0.0/16"
4367
+                  }
4368
+                ]
4369
+              }
4370
+            },
4371
+            "DriverState": {
4372
+              "Name": "overlay",
4373
+              "Options": {
4374
+                "com.docker.network.driver.overlay.vxlanid_list": "256"
4375
+              }
4376
+            },
4377
+            "IPAM": {
4378
+              "Driver": {
4379
+                "Name": "default"
4380
+              },
4381
+              "Configs": [
4382
+                {
4383
+                  "Family": "UNKNOWN",
4384
+                  "Subnet": "10.255.0.0/16"
4385
+                }
4386
+              ]
4387
+            }
4388
+          },
4389
+          "Addresses": [
4390
+            "10.255.0.10/16"
4391
+          ]
4392
+        }
4393
+      ],
4394
+      "Endpoint": {
4395
+        "Spec": {},
4396
+        "ExposedPorts": [
4397
+          {
4398
+            "Protocol": "tcp",
4399
+            "Port": 6379,
4400
+            "PublicPort": 30000
4401
+          }
4402
+        ],
4403
+        "VirtualIPs": [
4404
+          {
4405
+            "NetworkID": "4qvuz4ko70xaltuqbt8956gd1",
4406
+            "Addr": "10.255.0.2/16"
4407
+          },
4408
+          {
4409
+            "NetworkID": "4qvuz4ko70xaltuqbt8956gd1",
4410
+            "Addr": "10.255.0.3/16"
4411
+          }
4412
+        ]
4413
+      }
4414
+    }
4415
+
4416
+Status Codes:
4417
+
4418
+- **200** – no error
4419
+- **404** – unknown task
4420
+- **500** – server error
4421
+
3309 4422
 # 4. Going further
3310 4423
 
3311 4424
 ## 4.1 Inside `docker run`