1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370
|
---
title: "Engine API v1.24"
description: "API Documentation for Docker"
keywords: "API, Docker, rcli, REST, documentation"
redirect_from:
- /engine/reference/api/docker_remote_api_v1.24/
- /reference/api/docker_remote_api_v1.24/
---
<!-- This file is maintained within the moby/moby GitHub
repository at https://github.com/moby/moby/. Make all
pull requests against that repo. If you see this file in
another repository, consider it read-only there, as it will
periodically be overwritten by the definitive file. Pull
requests which include edits to this file in other repositories
will be rejected.
-->
## 1. Brief introduction
- The daemon listens on `unix:///var/run/docker.sock` but you can
[Bind Docker to another host/port or a Unix socket](https://docs.docker.com/engine/reference/commandline/dockerd/#bind-docker-to-another-host-port-or-a-unix-socket).
- The API tends to be REST. However, for some complex commands, like `attach`
or `pull`, the HTTP connection is hijacked to transport `stdout`,
`stdin` and `stderr`.
- A `Content-Length` header should be present in `POST` requests to endpoints
that expect a body.
- To lock to a specific version of the API, you prefix the URL with the version
of the API to use. For example, `/v1.18/info`. If no version is included in
the URL, the maximum supported API version is used.
- If the API version specified in the URL is not supported by the daemon, a HTTP
`400 Bad Request` error message is returned.
## 2. Errors
The Engine API uses standard HTTP status codes to indicate the success or failure of the API call. The body of the response will be JSON in the following format:
{
"message": "page not found"
}
The status codes that are returned for each endpoint are specified in the endpoint documentation below.
## 3. Endpoints
### 3.1 Containers
#### List containers
`GET /containers/json`
List containers
**Example request**:
GET /v1.24/containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"Id": "8dfafdbc3a40",
"Names":["/boring_feynman"],
"Image": "ubuntu:latest",
"ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
"Command": "echo 1",
"Created": 1367854155,
"State": "exited",
"Status": "Exit 0",
"Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
"Labels": {
"com.example.vendor": "Acme",
"com.example.license": "GPL",
"com.example.version": "1.0"
},
"SizeRw": 12288,
"SizeRootFs": 0,
"HostConfig": {
"NetworkMode": "default"
},
"NetworkSettings": {
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
"EndpointID": "2cdc4edb1ded3631c81f57966563e5c8525b81121bb3706a9a9a3ae102711f3f",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02"
}
}
},
"Mounts": [
{
"Name": "fac362...80535",
"Source": "/data",
"Destination": "/data",
"Driver": "local",
"Mode": "ro,Z",
"RW": false,
"Propagation": ""
}
]
},
{
"Id": "9cd87474be90",
"Names":["/coolName"],
"Image": "ubuntu:latest",
"ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
"Command": "echo 222222",
"Created": 1367854155,
"State": "exited",
"Status": "Exit 0",
"Ports": [],
"Labels": {},
"SizeRw": 12288,
"SizeRootFs": 0,
"HostConfig": {
"NetworkMode": "default"
},
"NetworkSettings": {
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
"EndpointID": "88eaed7b37b38c2a3f0c4bc796494fdf51b270c2d22656412a2ca5d559a64d7a",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.8",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:08"
}
}
},
"Mounts": []
},
{
"Id": "3176a2479c92",
"Names":["/sleepy_dog"],
"Image": "ubuntu:latest",
"ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
"Command": "echo 3333333333333333",
"Created": 1367854154,
"State": "exited",
"Status": "Exit 0",
"Ports":[],
"Labels": {},
"SizeRw":12288,
"SizeRootFs":0,
"HostConfig": {
"NetworkMode": "default"
},
"NetworkSettings": {
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
"EndpointID": "8b27c041c30326d59cd6e6f510d4f8d1d570a228466f956edf7815508f78e30d",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.6",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:06"
}
}
},
"Mounts": []
},
{
"Id": "4cb07b47f9fb",
"Names":["/running_cat"],
"Image": "ubuntu:latest",
"ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
"Command": "echo 444444444444444444444444444444444",
"Created": 1367854152,
"State": "exited",
"Status": "Exit 0",
"Ports": [],
"Labels": {},
"SizeRw": 12288,
"SizeRootFs": 0,
"HostConfig": {
"NetworkMode": "default"
},
"NetworkSettings": {
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
"EndpointID": "d91c7b2f0644403d7ef3095985ea0e2370325cd2332ff3a3225c4247328e66e9",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.5",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:05"
}
}
},
"Mounts": []
}
]
**Query parameters**:
- **all** – 1/True/true or 0/False/false, Show all containers.
Only running containers are shown by default (i.e., this defaults to false)
- **limit** – Show `limit` last created
containers, include non-running ones.
- **since** – Show only containers created since Id, include
non-running ones.
- **before** – Show only containers created before Id, include
non-running ones.
- **size** – 1/True/true or 0/False/false, Show the containers
sizes
- **filters** - a JSON encoded value of the filters (a `map[string][]string`) to process on the containers list. Available filters:
- `exited=<int>`; -- containers with exit code of `<int>` ;
- `status=`(`created`|`restarting`|`running`|`paused`|`exited`|`dead`)
- `label=key` or `label="key=value"` of a container label
- `isolation=`(`default`|`process`|`hyperv`) (Windows daemon only)
- `ancestor`=(`<image-name>[:<tag>]`, `<image id>` or `<image@digest>`)
- `before`=(`<container id>` or `<container name>`)
- `since`=(`<container id>` or `<container name>`)
- `volume`=(`<volume name>` or `<mount point destination>`)
- `network`=(`<network id>` or `<network name>`)
**Status codes**:
- **200** – no error
- **400** – bad parameter
- **500** – server error
#### Create a container
`POST /containers/create`
Create a container
**Example request**:
POST /v1.24/containers/create HTTP/1.1
Content-Type: application/json
Content-Length: 12345
{
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": true,
"AttachStderr": true,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"FOO=bar",
"BAZ=quux"
],
"Cmd": [
"date"
],
"Entrypoint": "",
"Image": "ubuntu",
"Labels": {
"com.example.vendor": "Acme",
"com.example.license": "GPL",
"com.example.version": "1.0"
},
"Volumes": {
"/volumes/data": {}
},
"Healthcheck":{
"Test": ["CMD-SHELL", "curl localhost:3000"],
"Interval": 1000000000,
"Timeout": 10000000000,
"Retries": 10,
"StartPeriod": 60000000000
},
"WorkingDir": "",
"NetworkDisabled": false,
"MacAddress": "12:34:56:78:9a:bc",
"ExposedPorts": {
"22/tcp": {}
},
"StopSignal": "SIGTERM",
"HostConfig": {
"Binds": ["/tmp:/tmp"],
"Tmpfs": { "/run": "rw,noexec,nosuid,size=65536k" },
"Links": ["redis3:redis"],
"Memory": 0,
"MemorySwap": 0,
"MemoryReservation": 0,
"KernelMemory": 0,
"CpuPercent": 80,
"CpuShares": 512,
"CpuPeriod": 100000,
"CpuQuota": 50000,
"CpusetCpus": "0,1",
"CpusetMems": "0,1",
"IOMaximumBandwidth": 0,
"IOMaximumIOps": 0,
"BlkioWeight": 300,
"BlkioWeightDevice": [{}],
"BlkioDeviceReadBps": [{}],
"BlkioDeviceReadIOps": [{}],
"BlkioDeviceWriteBps": [{}],
"BlkioDeviceWriteIOps": [{}],
"MemorySwappiness": 60,
"OomKillDisable": false,
"OomScoreAdj": 500,
"PidMode": "",
"PidsLimit": -1,
"PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
"PublishAllPorts": false,
"Privileged": false,
"ReadonlyRootfs": false,
"Dns": ["8.8.8.8"],
"DnsOptions": [""],
"DnsSearch": [""],
"ExtraHosts": null,
"VolumesFrom": ["parent", "other:ro"],
"CapAdd": ["NET_ADMIN"],
"CapDrop": ["MKNOD"],
"GroupAdd": ["newgroup"],
"RestartPolicy": { "Name": "", "MaximumRetryCount": 0 },
"NetworkMode": "bridge",
"Devices": [],
"Sysctls": { "net.ipv4.ip_forward": "1" },
"Ulimits": [{}],
"LogConfig": { "Type": "json-file", "Config": {} },
"SecurityOpt": [],
"StorageOpt": {},
"CgroupParent": "",
"VolumeDriver": "",
"ShmSize": 67108864
},
"NetworkingConfig": {
"EndpointsConfig": {
"isolated_nw" : {
"IPAMConfig": {
"IPv4Address":"172.20.30.33",
"IPv6Address":"2001:db8:abcd::3033",
"LinkLocalIPs":["169.254.34.68", "fe80::3468"]
},
"Links":["container_1", "container_2"],
"Aliases":["server_x", "server_y"]
}
}
}
}
**Example response**:
HTTP/1.1 201 Created
Content-Type: application/json
{
"Id":"e90e34656806",
"Warnings":[]
}
**JSON parameters**:
- **Hostname** - A string value containing the hostname to use for the
container. This must be a valid RFC 1123 hostname.
- **Domainname** - A string value containing the domain name to use
for the container.
- **User** - A string value specifying the user inside the container.
- **AttachStdin** - Boolean value, attaches to `stdin`.
- **AttachStdout** - Boolean value, attaches to `stdout`.
- **AttachStderr** - Boolean value, attaches to `stderr`.
- **Tty** - Boolean value, Attach standard streams to a `tty`, including `stdin` if it is not closed.
- **OpenStdin** - Boolean value, opens `stdin`,
- **StdinOnce** - Boolean value, close `stdin` after the 1 attached client disconnects.
- **Env** - A list of environment variables in the form of `["VAR=value", ...]`
- **Labels** - Adds a map of labels to a container. To specify a map: `{"key":"value", ... }`
- **Cmd** - Command to run specified as a string or an array of strings.
- **Entrypoint** - Set the entry point for the container as a string or an array
of strings.
- **Image** - A string specifying the image name to use for the container.
- **Volumes** - An object mapping mount point paths (strings) inside the
container to empty objects.
- **Healthcheck** - A test to perform to check that the container is healthy.
- **Test** - The test to perform. Possible values are:
+ `{}` inherit healthcheck from image or parent image
+ `{"NONE"}` disable healthcheck
+ `{"CMD", args...}` exec arguments directly
+ `{"CMD-SHELL", command}` run command with system's default shell
- **Interval** - The time to wait between checks in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means inherit.
- **Timeout** - The time to wait before considering the check to have hung. It should be 0 or at least 1000000 (1 ms). 0 means inherit.
- **Retries** - The number of consecutive failures needed to consider a container as unhealthy. 0 means inherit.
- **StartPeriod** - The time to wait for container initialization before starting health-retries countdown in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means inherit.
- **WorkingDir** - A string specifying the working directory for commands to
run in.
- **NetworkDisabled** - Boolean value, when true disables networking for the
container
- **ExposedPorts** - An object mapping ports to an empty object in the form of:
`"ExposedPorts": { "<port>/<tcp|udp>: {}" }`
- **StopSignal** - Signal to stop a container as a string or unsigned integer. `SIGTERM` by default.
- **HostConfig**
- **Binds** – A list of volume bindings for this container. Each volume binding is a string in one of these forms:
+ `host-src:container-dest` to bind-mount a host path into the
container. Both `host-src`, and `container-dest` must be an
_absolute_ path.
+ `host-src:container-dest:ro` to make the bind mount read-only
inside the container. Both `host-src`, and `container-dest` must be
an _absolute_ path.
+ `volume-name:container-dest` to bind-mount a volume managed by a
volume driver into the container. `container-dest` must be an
_absolute_ path.
+ `volume-name:container-dest:ro` to mount the volume read-only
inside the container. `container-dest` must be an _absolute_ path.
- **Tmpfs** – A map of container directories which should be replaced by tmpfs mounts, and their corresponding
mount options. A JSON object in the form `{ "/run": "rw,noexec,nosuid,size=65536k" }`.
- **Links** - A list of links for the container. Each link entry should be
in the form of `container_name:alias`.
- **Memory** - Memory limit in bytes.
- **MemorySwap** - Total memory limit (memory + swap); set `-1` to enable unlimited swap.
You must use this with `memory` and make the swap value larger than `memory`.
- **MemoryReservation** - Memory soft limit in bytes.
- **KernelMemory** - Kernel memory limit in bytes.
- **CpuPercent** - An integer value containing the usable percentage of the available CPUs. (Windows daemon only)
- **CpuShares** - An integer value containing the container's CPU Shares
(ie. the relative weight vs other containers).
- **CpuPeriod** - The length of a CPU period in microseconds.
- **CpuQuota** - Microseconds of CPU time that the container can get in a CPU period.
- **CpusetCpus** - String value containing the `cgroups CpusetCpus` to use.
- **CpusetMems** - Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
- **IOMaximumBandwidth** - Maximum IO absolute rate in terms of IOps.
- **IOMaximumIOps** - Maximum IO absolute rate in terms of bytes per second.
- **BlkioWeight** - Block IO weight (relative weight) accepts a weight value between 10 and 1000.
- **BlkioWeightDevice** - Block IO weight (relative device weight) in the form of: `"BlkioWeightDevice": [{"Path": "device_path", "Weight": weight}]`
- **BlkioDeviceReadBps** - Limit read rate (bytes per second) from a device in the form of: `"BlkioDeviceReadBps": [{"Path": "device_path", "Rate": rate}]`, for example:
`"BlkioDeviceReadBps": [{"Path": "/dev/sda", "Rate": "1024"}]"`
- **BlkioDeviceWriteBps** - Limit write rate (bytes per second) to a device in the form of: `"BlkioDeviceWriteBps": [{"Path": "device_path", "Rate": rate}]`, for example:
`"BlkioDeviceWriteBps": [{"Path": "/dev/sda", "Rate": "1024"}]"`
- **BlkioDeviceReadIOps** - Limit read rate (IO per second) from a device in the form of: `"BlkioDeviceReadIOps": [{"Path": "device_path", "Rate": rate}]`, for example:
`"BlkioDeviceReadIOps": [{"Path": "/dev/sda", "Rate": "1000"}]`
- **BlkioDeviceWriteIOps** - Limit write rate (IO per second) to a device in the form of: `"BlkioDeviceWriteIOps": [{"Path": "device_path", "Rate": rate}]`, for example:
`"BlkioDeviceWriteIOps": [{"Path": "/dev/sda", "Rate": "1000"}]`
- **MemorySwappiness** - Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
- **OomKillDisable** - Boolean value, whether to disable OOM Killer for the container or not.
- **OomScoreAdj** - An integer value containing the score given to the container in order to tune OOM killer preferences.
- **PidMode** - Set the PID (Process) Namespace mode for the container;
`"container:<name|id>"`: joins another container's PID namespace
`"host"`: use the host's PID namespace inside the container
- **PidsLimit** - Tune a container's pids limit. Set -1 for unlimited.
- **PortBindings** - A map of exposed container ports and the host port they
should map to. A JSON object in the form
`{ <port>/<protocol>: [{ "HostPort": "<port>" }] }`
Take note that `port` is specified as a string and not an integer value.
- **PublishAllPorts** - Allocates an ephemeral host port for all of a container's
exposed ports. Specified as a boolean value.
Ports are de-allocated when the container stops and allocated when the container starts.
The allocated port might be changed when restarting the container.
The port is selected from the ephemeral port range that depends on the kernel.
For example, on Linux the range is defined by `/proc/sys/net/ipv4/ip_local_port_range`.
- **Privileged** - Gives the container full access to the host. Specified as
a boolean value.
- **ReadonlyRootfs** - Mount the container's root filesystem as read only.
Specified as a boolean value.
- **Dns** - A list of DNS servers for the container to use.
- **DnsOptions** - A list of DNS options
- **DnsSearch** - A list of DNS search domains
- **ExtraHosts** - A list of hostnames/IP mappings to add to the
container's `/etc/hosts` file. Specified in the form `["hostname:IP"]`.
- **VolumesFrom** - A list of volumes to inherit from another container.
Specified in the form `<container name>[:<ro|rw>]`
- **CapAdd** - A list of kernel capabilities to add to the container.
- **Capdrop** - A list of kernel capabilities to drop from the container.
- **GroupAdd** - A list of additional groups that the container process will run as
- **RestartPolicy** – The behavior to apply when the container exits. The
value is an object with a `Name` property of either `"always"` to
always restart, `"unless-stopped"` to restart always except when
user has manually stopped the container or `"on-failure"` to restart only when the container
exit code is non-zero. If `on-failure` is used, `MaximumRetryCount`
controls the number of times to retry before giving up.
The default is not to restart. (optional)
An ever increasing delay (double the previous delay, starting at 100mS)
is added before each restart to prevent flooding the server.
- **UsernsMode** - Sets the usernamespace mode for the container when usernamespace remapping option is enabled.
supported values are: `host`.
- **NetworkMode** - Sets the networking mode for the container. Supported
standard values are: `bridge`, `host`, `none`, and `container:<name|id>`. Any other value is taken
as a custom network's name to which this container should connect to.
- **Devices** - A list of devices to add to the container specified as a JSON object in the
form
`{ "PathOnHost": "/dev/deviceName", "PathInContainer": "/dev/deviceName", "CgroupPermissions": "mrw"}`
- **Ulimits** - A list of ulimits to set in the container, specified as
`{ "Name": <name>, "Soft": <soft limit>, "Hard": <hard limit> }`, for example:
`Ulimits: { "Name": "nofile", "Soft": 1024, "Hard": 2048 }`
- **Sysctls** - A list of kernel parameters (sysctls) to set in the container, specified as
`{ <name>: <Value> }`, for example:
`{ "net.ipv4.ip_forward": "1" }`
- **SecurityOpt**: A list of string values to customize labels for MLS
systems, such as SELinux.
- **StorageOpt**: Storage driver options per container. Options can be passed in the form
`{"size":"120G"}`
- **LogConfig** - Log configuration for the container, specified as a JSON object in the form
`{ "Type": "<driver_name>", "Config": {"key1": "val1"}}`.
Available types: `json-file`, `syslog`, `journald`, `gelf`, `fluentd`, `awslogs`, `splunk`, `etwlogs`, `none`.
`json-file` logging driver.
- **CgroupParent** - Path to `cgroups` under which the container's `cgroup` is created. If the path is not absolute, the path is considered to be relative to the `cgroups` path of the init process. Cgroups are created if they do not already exist.
- **VolumeDriver** - Driver that this container users to mount volumes.
- **ShmSize** - Size of `/dev/shm` in bytes. The size must be greater than 0. If omitted the system uses 64MB.
**Query parameters**:
- **name** – Assign the specified name to the container. Must
match `/?[a-zA-Z0-9_-]+`.
**Status codes**:
- **201** – no error
- **400** – bad parameter
- **404** – no such image
- **406** – impossible to attach (container not running)
- **409** – conflict
- **500** – server error
#### Inspect a container
`GET /containers/(id or name)/json`
Return low-level information on the container `id`
**Example request**:
GET /v1.24/containers/4fa6e0f0c678/json HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{
"AppArmorProfile": "",
"Args": [
"-c",
"exit 9"
],
"Config": {
"AttachStderr": true,
"AttachStdin": false,
"AttachStdout": true,
"Cmd": [
"/bin/sh",
"-c",
"exit 9"
],
"Domainname": "",
"Entrypoint": null,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"ExposedPorts": null,
"Hostname": "ba033ac44011",
"Image": "ubuntu",
"Labels": {
"com.example.vendor": "Acme",
"com.example.license": "GPL",
"com.example.version": "1.0"
},
"MacAddress": "",
"NetworkDisabled": false,
"OnBuild": null,
"OpenStdin": false,
"StdinOnce": false,
"Tty": false,
"User": "",
"Volumes": {
"/volumes/data": {}
},
"WorkingDir": "",
"StopSignal": "SIGTERM"
},
"Created": "2015-01-06T15:47:31.485331387Z",
"Driver": "devicemapper",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"IOMaximumBandwidth": 0,
"IOMaximumIOps": 0,
"BlkioWeight": 0,
"BlkioWeightDevice": [{}],
"BlkioDeviceReadBps": [{}],
"BlkioDeviceWriteBps": [{}],
"BlkioDeviceReadIOps": [{}],
"BlkioDeviceWriteIOps": [{}],
"CapAdd": null,
"CapDrop": null,
"ContainerIDFile": "",
"CpusetCpus": "",
"CpusetMems": "",
"CpuPercent": 80,
"CpuShares": 0,
"CpuPeriod": 100000,
"Devices": [],
"Dns": null,
"DnsOptions": null,
"DnsSearch": null,
"ExtraHosts": null,
"IpcMode": "",
"Links": null,
"Memory": 0,
"MemorySwap": 0,
"MemoryReservation": 0,
"KernelMemory": 0,
"OomKillDisable": false,
"OomScoreAdj": 500,
"NetworkMode": "bridge",
"PidMode": "",
"PortBindings": {},
"Privileged": false,
"ReadonlyRootfs": false,
"PublishAllPorts": false,
"RestartPolicy": {
"MaximumRetryCount": 2,
"Name": "on-failure"
},
"LogConfig": {
"Config": null,
"Type": "json-file"
},
"SecurityOpt": null,
"Sysctls": {
"net.ipv4.ip_forward": "1"
},
"StorageOpt": null,
"VolumesFrom": null,
"Ulimits": [{}],
"VolumeDriver": "",
"ShmSize": 67108864
},
"HostnamePath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname",
"HostsPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts",
"LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
"Id": "ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39",
"Image": "04c5d3b7b0656168630d3ba35d8889bd0e9caafcaeb3004d2bfbc47e7c5d35d2",
"MountLabel": "",
"Name": "/boring_euclid",
"NetworkSettings": {
"Bridge": "",
"SandboxID": "",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": null,
"SandboxKey": "",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"bridge": {
"NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
"EndpointID": "7587b82f0dada3656fda26588aee72630c6fab1536d36e394b2bfbcf898c971d",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:12:00:02"
}
}
},
"Path": "/bin/sh",
"ProcessLabel": "",
"ResolvConfPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/resolv.conf",
"RestartCount": 1,
"State": {
"Error": "",
"ExitCode": 9,
"FinishedAt": "2015-01-06T15:47:32.080254511Z",
"OOMKilled": false,
"Dead": false,
"Paused": false,
"Pid": 0,
"Restarting": false,
"Running": true,
"StartedAt": "2015-01-06T15:47:32.072697474Z",
"Status": "running"
},
"Mounts": [
{
"Name": "fac362...80535",
"Source": "/data",
"Destination": "/data",
"Driver": "local",
"Mode": "ro,Z",
"RW": false,
"Propagation": ""
}
]
}
**Example request, with size information**:
GET /v1.24/containers/4fa6e0f0c678/json?size=1 HTTP/1.1
**Example response, with size information**:
HTTP/1.1 200 OK
Content-Type: application/json
{
....
"SizeRw": 0,
"SizeRootFs": 972,
....
}
**Query parameters**:
- **size** – 1/True/true or 0/False/false, return container size information. Default is `false`.
**Status codes**:
- **200** – no error
- **404** – no such container
- **500** – server error
#### List processes running inside a container
`GET /containers/(id or name)/top`
List processes running inside the container `id`. On Unix systems this
is done by running the `ps` command. This endpoint is not
supported on Windows.
**Example request**:
GET /v1.24/containers/4fa6e0f0c678/top HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{
"Titles" : [
"UID", "PID", "PPID", "C", "STIME", "TTY", "TIME", "CMD"
],
"Processes" : [
[
"root", "13642", "882", "0", "17:03", "pts/0", "00:00:00", "/bin/bash"
],
[
"root", "13735", "13642", "0", "17:06", "pts/0", "00:00:00", "sleep 10"
]
]
}
**Example request**:
GET /v1.24/containers/4fa6e0f0c678/top?ps_args=aux HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{
"Titles" : [
"USER","PID","%CPU","%MEM","VSZ","RSS","TTY","STAT","START","TIME","COMMAND"
]
"Processes" : [
[
"root","13642","0.0","0.1","18172","3184","pts/0","Ss","17:03","0:00","/bin/bash"
],
[
"root","13895","0.0","0.0","4348","692","pts/0","S+","17:15","0:00","sleep 10"
]
],
}
**Query parameters**:
- **ps_args** – `ps` arguments to use (e.g., `aux`), defaults to `-ef`
**Status codes**:
- **200** – no error
- **404** – no such container
- **500** – server error
#### Get container logs
`GET /containers/(id or name)/logs`
Get `stdout` and `stderr` logs from the container ``id``
> **Note**:
> This endpoint works only for containers with the `json-file` or `journald` logging drivers.
**Example request**:
GET /v1.24/containers/4fa6e0f0c678/logs?stderr=1&stdout=1×tamps=1&follow=1&tail=10&since=1428990821 HTTP/1.1
**Example response**:
HTTP/1.1 101 UPGRADED
Content-Type: application/vnd.docker.raw-stream
Connection: Upgrade
Upgrade: tcp
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
- **details** - 1/True/true or 0/False/false, Show extra details provided to logs. Default `false`.
- **follow** – 1/True/true or 0/False/false, return stream. Default `false`.
- **stdout** – 1/True/true or 0/False/false, show `stdout` log. Default `false`.
- **stderr** – 1/True/true or 0/False/false, show `stderr` log. Default `false`.
- **since** – UNIX timestamp (integer) to filter logs. Specifying a timestamp
will only output log-entries since that timestamp. Default: 0 (unfiltered)
- **timestamps** – 1/True/true or 0/False/false, print timestamps for
every log line. Default `false`.
- **tail** – Output specified number of lines at the end of logs: `all` or `<number>`. Default all.
**Status codes**:
- **101** – no error, hints proxy about hijacking
- **200** – no error, no upgrade header found
- **404** – no such container
- **500** – server error
#### Inspect changes on a container's filesystem
`GET /containers/(id or name)/changes`
Inspect changes on container `id`'s filesystem
**Example request**:
GET /v1.24/containers/4fa6e0f0c678/changes HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"Path": "/dev",
"Kind": 0
},
{
"Path": "/dev/kmsg",
"Kind": 1
},
{
"Path": "/test",
"Kind": 1
}
]
Values for `Kind`:
- `0`: Modify
- `1`: Add
- `2`: Delete
**Status codes**:
- **200** – no error
- **404** – no such container
- **500** – server error
#### Export a container
`GET /containers/(id or name)/export`
Export the contents of container `id`
**Example request**:
GET /v1.24/containers/4fa6e0f0c678/export HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Status codes**:
- **200** – no error
- **404** – no such container
- **500** – server error
#### Get container stats based on resource usage
`GET /containers/(id or name)/stats`
This endpoint returns a live stream of a container's resource usage statistics.
**Example request**:
GET /v1.24/containers/redis1/stats HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{
"read" : "2015-01-08T22:57:31.547920715Z",
"pids_stats": {
"current": 3
},
"networks": {
"eth0": {
"rx_bytes": 5338,
"rx_dropped": 0,
"rx_errors": 0,
"rx_packets": 36,
"tx_bytes": 648,
"tx_dropped": 0,
"tx_errors": 0,
"tx_packets": 8
},
"eth5": {
"rx_bytes": 4641,
"rx_dropped": 0,
"rx_errors": 0,
"rx_packets": 26,
"tx_bytes": 690,
"tx_dropped": 0,
"tx_errors": 0,
"tx_packets": 9
}
},
"memory_stats" : {
"stats" : {
"total_pgmajfault" : 0,
"cache" : 0,
"mapped_file" : 0,
"total_inactive_file" : 0,
"pgpgout" : 414,
"rss" : 6537216,
"total_mapped_file" : 0,
"writeback" : 0,
"unevictable" : 0,
"pgpgin" : 477,
"total_unevictable" : 0,
"pgmajfault" : 0,
"total_rss" : 6537216,
"total_rss_huge" : 6291456,
"total_writeback" : 0,
"total_inactive_anon" : 0,
"rss_huge" : 6291456,
"hierarchical_memory_limit" : 67108864,
"total_pgfault" : 964,
"total_active_file" : 0,
"active_anon" : 6537216,
"total_active_anon" : 6537216,
"total_pgpgout" : 414,
"total_cache" : 0,
"inactive_anon" : 0,
"active_file" : 0,
"pgfault" : 964,
"inactive_file" : 0,
"total_pgpgin" : 477
},
"max_usage" : 6651904,
"usage" : 6537216,
"failcnt" : 0,
"limit" : 67108864
},
"blkio_stats" : {},
"cpu_stats" : {
"cpu_usage" : {
"percpu_usage" : [
8646879,
24472255,
36438778,
30657443
],
"usage_in_usermode" : 50000000,
"total_usage" : 100215355,
"usage_in_kernelmode" : 30000000
},
"system_cpu_usage" : 739306590000000,
"throttling_data" : {"periods":0,"throttled_periods":0,"throttled_time":0}
},
"precpu_stats" : {
"cpu_usage" : {
"percpu_usage" : [
8646879,
24350896,
36438778,
30657443
],
"usage_in_usermode" : 50000000,
"total_usage" : 100093996,
"usage_in_kernelmode" : 30000000
},
"system_cpu_usage" : 9492140000000,
"throttling_data" : {"periods":0,"throttled_periods":0,"throttled_time":0}
}
}
The `precpu_stats` is the cpu statistic of *previous* read, which is used for calculating the cpu usage percent. It is not the exact copy of the `cpu_stats` field.
**Query parameters**:
- **stream** – 1/True/true or 0/False/false, pull stats once then disconnect. Default `true`.
**Status codes**:
- **200** – no error
- **404** – no such container
- **500** – server error
#### Resize a container TTY
`POST /containers/(id or name)/resize`
Resize the TTY for container with `id`. The unit is number of characters. You must restart the container for the resize to take effect.
**Example request**:
POST /v1.24/containers/4fa6e0f0c678/resize?h=40&w=80 HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/plain; charset=utf-8
**Query parameters**:
- **h** – height of `tty` session
- **w** – width
**Status codes**:
- **200** – no error
- **404** – No such container
- **500** – Cannot resize container
#### Start a container
`POST /containers/(id or name)/start`
Start the container `id`
**Example request**:
POST /v1.24/containers/e90e34656806/start HTTP/1.1
**Example response**:
HTTP/1.1 204 No Content
**Query parameters**:
- **detachKeys** – Override the key sequence for detaching a
container. Format is a single character `[a-Z]` or `ctrl-<value>`
where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
**Status codes**:
- **204** – no error
- **304** – container already started
- **404** – no such container
- **500** – server error
#### Stop a container
`POST /containers/(id or name)/stop`
Stop the container `id`
**Example request**:
POST /v1.24/containers/e90e34656806/stop?t=5 HTTP/1.1
**Example response**:
HTTP/1.1 204 No Content
**Query parameters**:
- **t** – number of seconds to wait before killing the container
**Status codes**:
- **204** – no error
- **304** – container already stopped
- **404** – no such container
- **500** – server error
#### Restart a container
`POST /containers/(id or name)/restart`
Restart the container `id`
**Example request**:
POST /v1.24/containers/e90e34656806/restart?t=5 HTTP/1.1
**Example response**:
HTTP/1.1 204 No Content
**Query parameters**:
- **t** – number of seconds to wait before killing the container
**Status codes**:
- **204** – no error
- **404** – no such container
- **500** – server error
#### Kill a container
`POST /containers/(id or name)/kill`
Kill the container `id`
**Example request**:
POST /v1.24/containers/e90e34656806/kill HTTP/1.1
**Example response**:
HTTP/1.1 204 No Content
**Query parameters**:
- **signal** - Signal to send to the container: integer or string like `SIGINT`.
When not set, `SIGKILL` is assumed and the call waits for the container to exit.
**Status codes**:
- **204** – no error
- **404** – no such container
- **500** – server error
#### Update a container
`POST /containers/(id or name)/update`
Update configuration of one or more containers.
**Example request**:
POST /v1.24/containers/e90e34656806/update HTTP/1.1
Content-Type: application/json
Content-Length: 12345
{
"BlkioWeight": 300,
"CpuShares": 512,
"CpuPeriod": 100000,
"CpuQuota": 50000,
"CpusetCpus": "0,1",
"CpusetMems": "0",
"Memory": 314572800,
"MemorySwap": 514288000,
"MemoryReservation": 209715200,
"KernelMemory": 52428800,
"RestartPolicy": {
"MaximumRetryCount": 4,
"Name": "on-failure"
}
}
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{
"Warnings": []
}
**Status codes**:
- **200** – no error
- **400** – bad parameter
- **404** – no such container
- **500** – server error
#### Rename a container
`POST /containers/(id or name)/rename`
Rename the container `id` to a `new_name`
**Example request**:
POST /v1.24/containers/e90e34656806/rename?name=new_name HTTP/1.1
**Example response**:
HTTP/1.1 204 No Content
**Query parameters**:
- **name** – new name for the container
**Status codes**:
- **204** – no error
- **404** – no such container
- **409** - conflict name already assigned
- **500** – server error
#### Pause a container
`POST /containers/(id or name)/pause`
Pause the container `id`
**Example request**:
POST /v1.24/containers/e90e34656806/pause HTTP/1.1
**Example response**:
HTTP/1.1 204 No Content
**Status codes**:
- **204** – no error
- **404** – no such container
- **500** – server error
#### Unpause a container
`POST /containers/(id or name)/unpause`
Unpause the container `id`
**Example request**:
POST /v1.24/containers/e90e34656806/unpause HTTP/1.1
**Example response**:
HTTP/1.1 204 No Content
**Status codes**:
- **204** – no error
- **404** – no such container
- **500** – server error
#### Attach to a container
`POST /containers/(id or name)/attach`
Attach to the container `id`
**Example request**:
POST /v1.24/containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
**Example response**:
HTTP/1.1 101 UPGRADED
Content-Type: application/vnd.docker.raw-stream
Connection: Upgrade
Upgrade: tcp
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
- **detachKeys** – Override the key sequence for detaching a
container. Format is a single character `[a-Z]` or `ctrl-<value>`
where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
- **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
- **stream** – 1/True/true or 0/False/false, return stream.
Default `false`.
- **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
to `stdin`. Default `false`.
- **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
`stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
- **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
`stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
**Status codes**:
- **101** – no error, hints proxy about hijacking
- **200** – no error, no upgrade header found
- **400** – bad parameter
- **404** – no such container
- **409** - container is paused
- **500** – server error
**Stream details**:
When using the TTY setting is enabled in
[`POST /containers/create`
](#create-a-container),
the stream is the raw data from the process PTY and client's `stdin`.
When the TTY is disabled, then the stream is multiplexed to separate
`stdout` and `stderr`.
The format is a **Header** and a **Payload** (frame).
**HEADER**
The header contains the information which the stream writes (`stdout` or
`stderr`). It also contains the size of the associated frame encoded in the
last four bytes (`uint32`).
It is encoded on the first eight bytes like this:
header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
`STREAM_TYPE` can be:
- 0: `stdin` (is written on `stdout`)
- 1: `stdout`
- 2: `stderr`
`SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of
the `uint32` size encoded as big endian.
**PAYLOAD**
The payload is the raw stream.
**IMPLEMENTATION**
The simplest way to implement the Attach protocol is the following:
1. Read eight bytes.
2. Choose `stdout` or `stderr` depending on the first byte.
3. Extract the frame size from the last four bytes.
4. Read the extracted size and output it on the correct output.
5. Goto 1.
#### Attach to a container (websocket)
`GET /containers/(id or name)/attach/ws`
Attach to the container `id` via websocket
Implements websocket protocol handshake according to [RFC 6455](http://tools.ietf.org/html/rfc6455)
**Example request**
GET /v1.24/containers/e90e34656806/attach/ws?logs=0&stream=1&stdin=1&stdout=1&stderr=1 HTTP/1.1
**Example response**
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
- **detachKeys** – Override the key sequence for detaching a
container. Format is a single character `[a-Z]` or `ctrl-<value>`
where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
- **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
- **stream** – 1/True/true or 0/False/false, return stream.
Default `false`.
**Status codes**:
- **200** – no error
- **400** – bad parameter
- **404** – no such container
- **500** – server error
#### Wait a container
`POST /containers/(id or name)/wait`
Block until container `id` stops, then returns the exit code
**Example request**:
POST /v1.24/containers/16253994b7c4/wait HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{"StatusCode": 0}
**Status codes**:
- **200** – no error
- **404** – no such container
- **500** – server error
#### Remove a container
`DELETE /containers/(id or name)`
Remove the container `id` from the filesystem
**Example request**:
DELETE /v1.24/containers/16253994b7c4?v=1 HTTP/1.1
**Example response**:
HTTP/1.1 204 No Content
**Query parameters**:
- **v** – 1/True/true or 0/False/false, Remove the volumes
associated to the container. Default `false`.
- **force** - 1/True/true or 0/False/false, Kill then remove the container.
Default `false`.
- **link** - 1/True/true or 0/False/false, Remove the specified
link associated to the container. Default `false`.
**Status codes**:
- **204** – no error
- **400** – bad parameter
- **404** – no such container
- **409** – conflict
- **500** – server error
#### Retrieving information about files and folders in a container
`HEAD /containers/(id or name)/archive`
See the description of the `X-Docker-Container-Path-Stat` header in the
following section.
#### Get an archive of a filesystem resource in a container
`GET /containers/(id or name)/archive`
Get a tar archive of a resource in the filesystem of container `id`.
**Query parameters**:
- **path** - resource in the container's filesystem to archive. Required.
If not an absolute path, it is relative to the container's root directory.
The resource specified by **path** must exist. To assert that the resource
is expected to be a directory, **path** should end in `/` or `/.`
(assuming a path separator of `/`). If **path** ends in `/.` then this
indicates that only the contents of the **path** directory should be
copied. A symlink is always resolved to its target.
> **Note**: It is not possible to copy certain system files such as resources
> under `/proc`, `/sys`, `/dev`, and mounts created by the user in the
> container.
**Example request**:
GET /v1.24/containers/8cce319429b2/archive?path=/root HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/x-tar
X-Docker-Container-Path-Stat: eyJuYW1lIjoicm9vdCIsInNpemUiOjQwOTYsIm1vZGUiOjIxNDc0ODQwOTYsIm10aW1lIjoiMjAxNC0wMi0yN1QyMDo1MToyM1oiLCJsaW5rVGFyZ2V0IjoiIn0=
{% raw %}
{{ TAR STREAM }}
{% endraw %}
On success, a response header `X-Docker-Container-Path-Stat` will be set to a
base64-encoded JSON object containing some filesystem header information about
the archived resource. The above example value would decode to the following
JSON object (whitespace added for readability):
```json
{
"name": "root",
"size": 4096,
"mode": 2147484096,
"mtime": "2014-02-27T20:51:23Z",
"linkTarget": ""
}
```
A `HEAD` request can also be made to this endpoint if only this information is
desired.
**Status codes**:
- **200** - success, returns archive of copied resource
- **400** - client error, bad parameter, details in JSON response body, one of:
- must specify path parameter (**path** cannot be empty)
- not a directory (**path** was asserted to be a directory but exists as a
file)
- **404** - client error, resource not found, one of:
– no such container (container `id` does not exist)
- no such file or directory (**path** does not exist)
- **500** - server error
#### Extract an archive of files or folders to a directory in a container
`PUT /containers/(id or name)/archive`
Upload a tar archive to be extracted to a path in the filesystem of container
`id`.
**Query parameters**:
- **path** - path to a directory in the container
to extract the archive's contents into. Required.
If not an absolute path, it is relative to the container's root directory.
The **path** resource must exist.
- **noOverwriteDirNonDir** - If "1", "true", or "True" then it will be an error
if unpacking the given content would cause an existing directory to be
replaced with a non-directory and vice versa.
**Example request**:
PUT /v1.24/containers/8cce319429b2/archive?path=/vol1 HTTP/1.1
Content-Type: application/x-tar
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Example response**:
HTTP/1.1 200 OK
**Status codes**:
- **200** – the content was extracted successfully
- **400** - client error, bad parameter, details in JSON response body, one of:
- must specify path parameter (**path** cannot be empty)
- not a directory (**path** should be a directory but exists as a file)
- unable to overwrite existing directory with non-directory
(if **noOverwriteDirNonDir**)
- unable to overwrite existing non-directory with directory
(if **noOverwriteDirNonDir**)
- **403** - client error, permission denied, the volume
or container rootfs is marked as read-only.
- **404** - client error, resource not found, one of:
– no such container (container `id` does not exist)
- no such file or directory (**path** resource does not exist)
- **500** – server error
### 3.2 Images
#### List Images
`GET /images/json`
**Example request**:
GET /v1.24/images/json?all=0 HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"RepoTags": [
"ubuntu:12.04",
"ubuntu:precise",
"ubuntu:latest"
],
"Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
"Created": 1365714795,
"Size": 131506275,
"VirtualSize": 131506275,
"Labels": {}
},
{
"RepoTags": [
"ubuntu:12.10",
"ubuntu:quantal"
],
"ParentId": "27cf784147099545",
"Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
"Created": 1364102658,
"Size": 24653,
"VirtualSize": 180116135,
"Labels": {
"com.example.version": "v1"
}
}
]
**Example request, with digest information**:
GET /v1.24/images/json?digests=1 HTTP/1.1
**Example response, with digest information**:
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"Created": 1420064636,
"Id": "4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125",
"ParentId": "ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2",
"RepoDigests": [
"localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
],
"RepoTags": [
"localhost:5000/test/busybox:latest",
"playdate:latest"
],
"Size": 0,
"VirtualSize": 2429728,
"Labels": {}
}
]
The response shows a single image `Id` associated with two repositories
(`RepoTags`): `localhost:5000/test/busybox`: and `playdate`. A caller can use
either of the `RepoTags` values `localhost:5000/test/busybox:latest` or
`playdate:latest` to reference the image.
You can also use `RepoDigests` values to reference an image. In this response,
the array has only one reference and that is to the
`localhost:5000/test/busybox` repository; the `playdate` repository has no
digest. You can reference this digest using the value:
`localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d...`
See the `docker run` and `docker build` commands for examples of digest and tag
references on the command line.
**Query parameters**:
- **all** – 1/True/true or 0/False/false, default false
- **filters** – a JSON encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
- `dangling=true`
- `label=key` or `label="key=value"` of an image label
- `before`=(`<image-name>[:<tag>]`, `<image id>` or `<image@digest>`)
- `since`=(`<image-name>[:<tag>]`, `<image id>` or `<image@digest>`)
- **filter** - only return images with the specified name
#### Build image from a Dockerfile
`POST /build`
Build an image from a Dockerfile
**Example request**:
POST /v1.24/build HTTP/1.1
Content-Type: application/x-tar
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{"stream": "Step 1/5..."}
{"stream": "..."}
{"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
The input stream must be a `tar` archive compressed with one of the
following algorithms: `identity` (no compression), `gzip`, `bzip2`, `xz`.
The archive must include a build instructions file, typically called
`Dockerfile` at the archive's root. The `dockerfile` parameter may be
used to specify a different build instructions file. To do this, its value must be
the path to the alternate build instructions file to use.
The archive may include any number of other files,
which are accessible in the build context (See the [*ADD build
command*](https://docs.docker.com/engine/reference/builder/#add)).
The Docker daemon performs a preliminary validation of the `Dockerfile` before
starting the build, and returns an error if the syntax is incorrect. After that,
each instruction is run one-by-one until the ID of the new image is output.
The build is canceled if the client drops the connection by quitting
or being killed.
**Query parameters**:
- **dockerfile** - Path within the build context to the `Dockerfile`. This is
ignored if `remote` is specified and points to an external `Dockerfile`.
- **t** – A name and optional tag to apply to the image in the `name:tag` format.
If you omit the `tag` the default `latest` value is assumed.
You can provide one or more `t` parameters.
- **remote** – A Git repository URI or HTTP/HTTPS context URI. If the
URI points to a single text file, the file's contents are placed into
a file called `Dockerfile` and the image is built from that file. If
the URI points to a tarball, the file is downloaded by the daemon and
the contents therein used as the context for the build. If the URI
points to a tarball and the `dockerfile` parameter is also specified,
there must be a file with the corresponding path inside the tarball.
- **q** – Suppress verbose build output.
- **nocache** – Do not use the cache when building the image.
- **pull** - Attempt to pull the image even if an older image exists locally.
- **rm** - Remove intermediate containers after a successful build (default behavior).
- **forcerm** - Always remove intermediate containers (includes `rm`).
- **memory** - Set memory limit for build.
- **memswap** - Total memory (memory + swap), `-1` to enable unlimited swap.
- **cpushares** - CPU shares (relative weight).
- **cpusetcpus** - CPUs in which to allow execution (e.g., `0-3`, `0,1`).
- **cpuperiod** - The length of a CPU period in microseconds.
- **cpuquota** - Microseconds of CPU time that the container can get in a CPU period.
- **buildargs** – JSON map of string pairs for build-time variables. Users pass
these values at build-time. Docker uses the `buildargs` as the environment
context for command(s) run via the Dockerfile's `RUN` instruction or for
variable expansion in other Dockerfile instructions. This is not meant for
passing secret values. [Read more about the buildargs instruction](https://docs.docker.com/engine/reference/builder/#arg)
- **shmsize** - Size of `/dev/shm` in bytes. The size must be greater than 0. If omitted the system uses 64MB.
- **labels** – JSON map of string pairs for labels to set on the image.
**Request Headers**:
- **Content-type** – Set to `"application/x-tar"`.
- **X-Registry-Config** – A base64-url-safe-encoded Registry Auth Config JSON
object with the following structure:
{
"docker.example.com": {
"username": "janedoe",
"password": "hunter2"
},
"https://index.docker.io/v1/": {
"username": "mobydock",
"password": "conta1n3rize14"
}
}
This object maps the hostname of a registry to an object containing the
"username" and "password" for that registry. Multiple registries may
be specified as the build may be based on an image requiring
authentication to pull from any arbitrary registry. Only the registry
domain name (and port if not the default "443") are required. However
(for legacy reasons) the "official" Docker, Inc. hosted registry must
be specified with both a "https://" prefix and a "/v1/" suffix even
though Docker will prefer to use the v2 registry API.
**Status codes**:
- **200** – no error
- **500** – server error
#### Create an image
`POST /images/create`
Create an image either by pulling it from the registry or by importing it
**Example request**:
POST /v1.24/images/create?fromImage=busybox&tag=latest HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{"status": "Pulling..."}
{"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
{"error": "Invalid..."}
...
When using this endpoint to pull an image from the registry, the
`X-Registry-Auth` header can be used to include
a base64-encoded AuthConfig object.
**Query parameters**:
- **fromImage** – Name of the image to pull. The name may include a tag or
digest. This parameter may only be used when pulling an image.
The pull is cancelled if the HTTP connection is closed.
- **fromSrc** – Source to import. The value may be a URL from which the image
can be retrieved or `-` to read the image from the request body.
This parameter may only be used when importing an image.
- **repo** – Repository name given to an image when it is imported.
The repo may include a tag. This parameter may only be used when importing
an image.
- **tag** – Tag or digest. If empty when pulling an image, this causes all tags
for the given image to be pulled.
**Request Headers**:
- **X-Registry-Auth** – base64-encoded AuthConfig object, containing either login information, or a token
- Credential based login:
```
{
"username": "jdoe",
"password": "secret",
"email": "jdoe@acme.com"
}
```
- Token based login:
```
{
"identitytoken": "9cbaf023786cd7..."
}
```
**Status codes**:
- **200** – no error
- **404** - repository does not exist or no read access
- **500** – server error
#### Inspect an image
`GET /images/(name)/json`
Return low-level information on the image `name`
**Example request**:
GET /v1.24/images/example/json HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{
"Id" : "sha256:85f05633ddc1c50679be2b16a0479ab6f7637f8884e0cfe0f4d20e1ebb3d6e7c",
"Container" : "cb91e48a60d01f1e27028b4fc6819f4f290b3cf12496c8176ec714d0d390984a",
"Comment" : "",
"Os" : "linux",
"Architecture" : "amd64",
"Parent" : "sha256:91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
"ContainerConfig" : {
"Tty" : false,
"Hostname" : "e611e15f9c9d",
"Volumes" : null,
"Domainname" : "",
"AttachStdout" : false,
"PublishService" : "",
"AttachStdin" : false,
"OpenStdin" : false,
"StdinOnce" : false,
"NetworkDisabled" : false,
"OnBuild" : [],
"Image" : "91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
"User" : "",
"WorkingDir" : "",
"Entrypoint" : null,
"MacAddress" : "",
"AttachStderr" : false,
"Labels" : {
"com.example.license" : "GPL",
"com.example.version" : "1.0",
"com.example.vendor" : "Acme"
},
"Env" : [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"ExposedPorts" : null,
"Cmd" : [
"/bin/sh",
"-c",
"#(nop) LABEL com.example.vendor=Acme com.example.license=GPL com.example.version=1.0"
]
},
"DockerVersion" : "1.9.0-dev",
"VirtualSize" : 188359297,
"Size" : 0,
"Author" : "",
"Created" : "2015-09-10T08:30:53.26995814Z",
"GraphDriver" : {
"Name" : "aufs",
"Data" : null
},
"RepoDigests" : [
"localhost:5000/test/busybox/example@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
],
"RepoTags" : [
"example:1.0",
"example:latest",
"example:stable"
],
"Config" : {
"Image" : "91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
"NetworkDisabled" : false,
"OnBuild" : [],
"StdinOnce" : false,
"PublishService" : "",
"AttachStdin" : false,
"OpenStdin" : false,
"Domainname" : "",
"AttachStdout" : false,
"Tty" : false,
"Hostname" : "e611e15f9c9d",
"Volumes" : null,
"Cmd" : [
"/bin/bash"
],
"ExposedPorts" : null,
"Env" : [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Labels" : {
"com.example.vendor" : "Acme",
"com.example.version" : "1.0",
"com.example.license" : "GPL"
},
"Entrypoint" : null,
"MacAddress" : "",
"AttachStderr" : false,
"WorkingDir" : "",
"User" : ""
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:1834950e52ce4d5a88a1bbd131c537f4d0e56d10ff0dd69e66be3b7dfa9df7e6",
"sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
]
}
}
**Status codes**:
- **200** – no error
- **404** – no such image
- **500** – server error
#### Get the history of an image
`GET /images/(name)/history`
Return the history of the image `name`
**Example request**:
GET /v1.24/images/ubuntu/history HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"Id": "3db9c44f45209632d6050b35958829c3a2aa256d81b9a7be45b362ff85c54710",
"Created": 1398108230,
"CreatedBy": "/bin/sh -c #(nop) ADD file:eb15dbd63394e063b805a3c32ca7bf0266ef64676d5a6fab4801f2e81e2a5148 in /",
"Tags": [
"ubuntu:lucid",
"ubuntu:10.04"
],
"Size": 182964289,
"Comment": ""
},
{
"Id": "6cfa4d1f33fb861d4d114f43b25abd0ac737509268065cdfd69d544a59c85ab8",
"Created": 1398108222,
"CreatedBy": "/bin/sh -c #(nop) MAINTAINER Tianon Gravi <admwiggin@gmail.com> - mkimage-debootstrap.sh -i iproute,iputils-ping,ubuntu-minimal -t lucid.tar.xz lucid http://archive.ubuntu.com/ubuntu/",
"Tags": null,
"Size": 0,
"Comment": ""
},
{
"Id": "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158",
"Created": 1371157430,
"CreatedBy": "",
"Tags": [
"scratch12:latest",
"scratch:latest"
],
"Size": 0,
"Comment": "Imported from -"
}
]
**Status codes**:
- **200** – no error
- **404** – no such image
- **500** – server error
#### Push an image on the registry
`POST /images/(name)/push`
Push the image `name` on the registry
**Example request**:
POST /v1.24/images/test/push HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{"status": "Pushing..."}
{"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
{"error": "Invalid..."}
...
If you wish to push an image on to a private registry, that image must already have a tag
into a repository which references that registry `hostname` and `port`. This repository name should
then be used in the URL. This duplicates the command line's flow.
The push is cancelled if the HTTP connection is closed.
**Example request**:
POST /v1.24/images/registry.acme.com:5000/test/push HTTP/1.1
**Query parameters**:
- **tag** – The tag to associate with the image on the registry. This is optional.
**Request Headers**:
- **X-Registry-Auth** – base64-encoded AuthConfig object, containing either login information, or a token
- Credential based login:
```
{
"username": "jdoe",
"password": "secret",
"email": "jdoe@acme.com",
}
```
- Identity token based login:
```
{
"identitytoken": "9cbaf023786cd7..."
}
```
**Status codes**:
- **200** – no error
- **404** – no such image
- **500** – server error
#### Tag an image into a repository
`POST /images/(name)/tag`
Tag the image `name` into a repository
**Example request**:
POST /v1.24/images/test/tag?repo=myrepo&tag=v42 HTTP/1.1
**Example response**:
HTTP/1.1 201 Created
**Query parameters**:
- **repo** – The repository to tag in
- **tag** - The new tag name
**Status codes**:
- **201** – no error
- **400** – bad parameter
- **404** – no such image
- **409** – conflict
- **500** – server error
#### Remove an image
`DELETE /images/(name)`
Remove the image `name` from the filesystem
**Example request**:
DELETE /v1.24/images/test HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-type: application/json
[
{"Untagged": "3e2f21a89f"},
{"Deleted": "3e2f21a89f"},
{"Deleted": "53b4f83ac9"}
]
**Query parameters**:
- **force** – 1/True/true or 0/False/false, default false
- **noprune** – 1/True/true or 0/False/false, default false
**Status codes**:
- **200** – no error
- **404** – no such image
- **409** – conflict
- **500** – server error
#### Search images
`GET /images/search`
Search for an image on [Docker Hub](https://hub.docker.com).
> **Note**:
> The response keys have changed from API v1.6 to reflect the JSON
> sent by the registry server to the docker daemon's request.
**Example request**:
GET /v1.24/images/search?term=sshd HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"description": "",
"is_official": false,
"is_automated": false,
"name": "wma55/u1210sshd",
"star_count": 0
},
{
"description": "",
"is_official": false,
"is_automated": false,
"name": "jdswinbank/sshd",
"star_count": 0
},
{
"description": "",
"is_official": false,
"is_automated": false,
"name": "vgauthier/sshd",
"star_count": 0
}
...
]
**Query parameters**:
- **term** – term to search
- **limit** – maximum returned search results
- **filters** – a JSON encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
- `stars=<number>`
- `is-automated=(true|false)`
- `is-official=(true|false)`
**Status codes**:
- **200** – no error
- **500** – server error
### 3.3 Misc
#### Check auth configuration
`POST /auth`
Validate credentials for a registry and get identity token,
if available, for accessing the registry without password.
**Example request**:
POST /v1.24/auth HTTP/1.1
Content-Type: application/json
Content-Length: 12345
{
"username": "hannibal",
"password": "xxxx",
"serveraddress": "https://index.docker.io/v1/"
}
**Example response**:
HTTP/1.1 200 OK
{
"Status": "Login Succeeded",
"IdentityToken": "9cbaf023786cd7..."
}
**Status codes**:
- **200** – no error
- **204** – no error
- **500** – server error
#### Display system-wide information
`GET /info`
Display system-wide information
**Example request**:
GET /v1.24/info HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{
"Architecture": "x86_64",
"ClusterStore": "etcd://localhost:2379",
"CgroupDriver": "cgroupfs",
"Containers": 11,
"ContainersRunning": 7,
"ContainersStopped": 3,
"ContainersPaused": 1,
"CpuCfsPeriod": true,
"CpuCfsQuota": true,
"Debug": false,
"DockerRootDir": "/var/lib/docker",
"Driver": "btrfs",
"DriverStatus": [[""]],
"ExperimentalBuild": false,
"HttpProxy": "http://test:test@localhost:8080",
"HttpsProxy": "https://test:test@localhost:8080",
"ID": "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS",
"IPv4Forwarding": true,
"Images": 16,
"IndexServerAddress": "https://index.docker.io/v1/",
"InitPath": "/usr/bin/docker",
"InitSha1": "",
"KernelMemory": true,
"KernelVersion": "3.12.0-1-amd64",
"Labels": [
"storage=ssd"
],
"MemTotal": 2099236864,
"MemoryLimit": true,
"NCPU": 1,
"NEventsListener": 0,
"NFd": 11,
"NGoroutines": 21,
"Name": "prod-server-42",
"NoProxy": "9.81.1.160",
"OomKillDisable": true,
"OSType": "linux",
"OperatingSystem": "Boot2Docker",
"Plugins": {
"Volume": [
"local"
],
"Network": [
"null",
"host",
"bridge"
]
},
"RegistryConfig": {
"IndexConfigs": {
"docker.io": {
"Mirrors": null,
"Name": "docker.io",
"Official": true,
"Secure": true
}
},
"InsecureRegistryCIDRs": [
"127.0.0.0/8"
]
},
"SecurityOptions": [
"apparmor",
"seccomp",
"selinux"
],
"ServerVersion": "1.9.0",
"SwapLimit": false,
"SystemStatus": [["State", "Healthy"]],
"SystemTime": "2015-03-10T11:11:23.730591467-07:00"
}
**Status codes**:
- **200** – no error
- **500** – server error
#### Show the docker version information
`GET /version`
Show the docker version information
**Example request**:
GET /v1.24/version HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{
"Version": "1.12.0",
"Os": "linux",
"KernelVersion": "3.19.0-23-generic",
"GoVersion": "go1.6.3",
"GitCommit": "deadbee",
"Arch": "amd64",
"ApiVersion": "1.24",
"BuildTime": "2016-06-14T07:09:13.444803460+00:00",
"Experimental": true
}
**Status codes**:
- **200** – no error
- **500** – server error
#### Ping the docker server
`GET /_ping`
Ping the docker server
**Example request**:
GET /v1.24/_ping HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: text/plain
OK
**Status codes**:
- **200** - no error
- **500** - server error
#### Create a new image from a container's changes
`POST /commit`
Create a new image from a container's changes
**Example request**:
POST /v1.24/commit?container=44c004db4b17&comment=message&repo=myrepo HTTP/1.1
Content-Type: application/json
Content-Length: 12345
{
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": true,
"AttachStderr": true,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": null,
"Cmd": [
"date"
],
"Mounts": [
{
"Source": "/data",
"Destination": "/data",
"Mode": "ro,Z",
"RW": false
}
],
"Labels": {
"key1": "value1",
"key2": "value2"
},
"WorkingDir": "",
"NetworkDisabled": false,
"ExposedPorts": {
"22/tcp": {}
}
}
**Example response**:
HTTP/1.1 201 Created
Content-Type: application/json
{"Id": "596069db4bf5"}
**JSON parameters**:
- **config** - the container's configuration
**Query parameters**:
- **container** – source container
- **repo** – repository
- **tag** – tag
- **comment** – commit message
- **author** – author (e.g., "John Hannibal Smith
<[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
- **pause** – 1/True/true or 0/False/false, whether to pause the container before committing
- **changes** – Dockerfile instructions to apply while committing
**Status codes**:
- **201** – no error
- **404** – no such container
- **500** – server error
#### Monitor Docker's events
`GET /events`
Get container events from docker, in real time via streaming.
Docker containers report the following events:
attach, commit, copy, create, destroy, detach, die, exec_create, exec_detach, exec_start, export, health_status, kill, oom, pause, rename, resize, restart, start, stop, top, unpause, update
Docker images report the following events:
delete, import, load, pull, push, save, tag, untag
Docker volumes report the following events:
create, mount, unmount, destroy
Docker networks report the following events:
create, connect, disconnect, destroy
Docker daemon report the following event:
reload
**Example request**:
GET /v1.24/events?since=1374067924
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
Server: Docker/1.12.0 (linux)
Date: Fri, 29 Apr 2016 15:18:06 GMT
Transfer-Encoding: chunked
{
"status": "pull",
"id": "alpine:latest",
"Type": "image",
"Action": "pull",
"Actor": {
"ID": "alpine:latest",
"Attributes": {
"name": "alpine"
}
},
"time": 1461943101,
"timeNano": 1461943101301854122
}
{
"status": "create",
"id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
"from": "alpine",
"Type": "container",
"Action": "create",
"Actor": {
"ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
"Attributes": {
"com.example.some-label": "some-label-value",
"image": "alpine",
"name": "my-container"
}
},
"time": 1461943101,
"timeNano": 1461943101381709551
}
{
"status": "attach",
"id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
"from": "alpine",
"Type": "container",
"Action": "attach",
"Actor": {
"ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
"Attributes": {
"com.example.some-label": "some-label-value",
"image": "alpine",
"name": "my-container"
}
},
"time": 1461943101,
"timeNano": 1461943101383858412
}
{
"Type": "network",
"Action": "connect",
"Actor": {
"ID": "7dc8ac97d5d29ef6c31b6052f3938c1e8f2749abbd17d1bd1febf2608db1b474",
"Attributes": {
"container": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
"name": "bridge",
"type": "bridge"
}
},
"time": 1461943101,
"timeNano": 1461943101394865557
}
{
"status": "start",
"id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
"from": "alpine",
"Type": "container",
"Action": "start",
"Actor": {
"ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
"Attributes": {
"com.example.some-label": "some-label-value",
"image": "alpine",
"name": "my-container"
}
},
"time": 1461943101,
"timeNano": 1461943101607533796
}
{
"status": "resize",
"id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
"from": "alpine",
"Type": "container",
"Action": "resize",
"Actor": {
"ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
"Attributes": {
"com.example.some-label": "some-label-value",
"height": "46",
"image": "alpine",
"name": "my-container",
"width": "204"
}
},
"time": 1461943101,
"timeNano": 1461943101610269268
}
{
"status": "die",
"id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
"from": "alpine",
"Type": "container",
"Action": "die",
"Actor": {
"ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
"Attributes": {
"com.example.some-label": "some-label-value",
"exitCode": "0",
"image": "alpine",
"name": "my-container"
}
},
"time": 1461943105,
"timeNano": 1461943105079144137
}
{
"Type": "network",
"Action": "disconnect",
"Actor": {
"ID": "7dc8ac97d5d29ef6c31b6052f3938c1e8f2749abbd17d1bd1febf2608db1b474",
"Attributes": {
"container": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
"name": "bridge",
"type": "bridge"
}
},
"time": 1461943105,
"timeNano": 1461943105230860245
}
{
"status": "destroy",
"id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
"from": "alpine",
"Type": "container",
"Action": "destroy",
"Actor": {
"ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
"Attributes": {
"com.example.some-label": "some-label-value",
"image": "alpine",
"name": "my-container"
}
},
"time": 1461943105,
"timeNano": 1461943105338056026
}
**Query parameters**:
- **since** – Timestamp. Show all events created since timestamp and then stream
- **until** – Timestamp. Show events created until given timestamp and stop streaming
- **filters** – A json encoded value of the filters (a map[string][]string) to process on the event list. Available filters:
- `container=<string>`; -- container to filter
- `event=<string>`; -- event to filter
- `image=<string>`; -- image to filter
- `label=<string>`; -- image and container label to filter
- `type=<string>`; -- either `container` or `image` or `volume` or `network` or `daemon`
- `volume=<string>`; -- volume to filter
- `network=<string>`; -- network to filter
- `daemon=<string>`; -- daemon name or id to filter
**Status codes**:
- **200** – no error
- **400** - bad parameter
- **500** – server error
#### Get a tarball containing all images in a repository
`GET /images/(name)/get`
Get a tarball containing all images and metadata for the repository specified
by `name`.
If `name` is a specific name and tag (e.g. ubuntu:latest), then only that image
(and its parents) are returned. If `name` is an image ID, similarly only that
image (and its parents) are returned, but with the exclusion of the
'repositories' file in the tarball, as there were no image names referenced.
See the [image tarball format](#image-tarball-format) for more details.
**Example request**
GET /v1.24/images/ubuntu/get
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/x-tar
Binary data stream
**Status codes**:
- **200** – no error
- **500** – server error
#### Get a tarball containing all images
`GET /images/get`
Get a tarball containing all images and metadata for one or more repositories.
For each value of the `names` parameter: if it is a specific name and tag (e.g.
`ubuntu:latest`), then only that image (and its parents) are returned; if it is
an image ID, similarly only that image (and its parents) are returned and there
would be no names referenced in the 'repositories' file for this image ID.
See the [image tarball format](#image-tarball-format) for more details.
**Example request**
GET /v1.24/images/get?names=myname%2Fmyapp%3Alatest&names=busybox
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/x-tar
Binary data stream
**Status codes**:
- **200** – no error
- **500** – server error
#### Load a tarball with a set of images and tags into docker
`POST /images/load`
Load a set of images and tags into a Docker repository.
See the [image tarball format](#image-tarball-format) for more details.
**Example request**
POST /v1.24/images/load
Content-Type: application/x-tar
Content-Length: 12345
Tarball in body
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked
{"status":"Loading layer","progressDetail":{"current":32768,"total":1292800},"progress":"[= ] 32.77 kB/1.293 MB","id":"8ac8bfaff55a"}
{"status":"Loading layer","progressDetail":{"current":65536,"total":1292800},"progress":"[== ] 65.54 kB/1.293 MB","id":"8ac8bfaff55a"}
{"status":"Loading layer","progressDetail":{"current":98304,"total":1292800},"progress":"[=== ] 98.3 kB/1.293 MB","id":"8ac8bfaff55a"}
{"status":"Loading layer","progressDetail":{"current":131072,"total":1292800},"progress":"[===== ] 131.1 kB/1.293 MB","id":"8ac8bfaff55a"}
...
{"stream":"Loaded image: busybox:latest\n"}
**Example response**:
If the "quiet" query parameter is set to `true` / `1` (`?quiet=1`), progress
details are suppressed, and only a confirmation message is returned once the
action completes.
HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked
{"stream":"Loaded image: busybox:latest\n"}
**Query parameters**:
- **quiet** – Boolean value, suppress progress details during load. Defaults
to `0` / `false` if omitted.
**Status codes**:
- **200** – no error
- **500** – server error
#### Image tarball format
An image tarball contains one directory per image layer (named using its long ID),
each containing these files:
- `VERSION`: currently `1.0` - the file format version
- `json`: detailed layer information, similar to `docker inspect layer_id`
- `layer.tar`: A tarfile containing the filesystem changes in this layer
The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories
for storing attribute changes and deletions.
If the tarball defines a repository, the tarball should also include a `repositories` file at
the root that contains a list of repository and tag names mapped to layer IDs.
```
{"hello-world":
{"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
}
```
#### Exec Create
`POST /containers/(id or name)/exec`
Sets up an exec instance in a running container `id`
**Example request**:
POST /v1.24/containers/e90e34656806/exec HTTP/1.1
Content-Type: application/json
Content-Length: 12345
{
"AttachStdin": true,
"AttachStdout": true,
"AttachStderr": true,
"Cmd": ["sh"],
"DetachKeys": "ctrl-p,ctrl-q",
"Privileged": true,
"Tty": true,
"User": "123:456"
}
**Example response**:
HTTP/1.1 201 Created
Content-Type: application/json
{
"Id": "f90e34656806",
"Warnings":[]
}
**JSON parameters**:
- **AttachStdin** - Boolean value, attaches to `stdin` of the `exec` command.
- **AttachStdout** - Boolean value, attaches to `stdout` of the `exec` command.
- **AttachStderr** - Boolean value, attaches to `stderr` of the `exec` command.
- **DetachKeys** – Override the key sequence for detaching a
container. Format is a single character `[a-Z]` or `ctrl-<value>`
where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
- **Tty** - Boolean value to allocate a pseudo-TTY.
- **Cmd** - Command to run specified as a string or an array of strings.
- **Privileged** - Boolean value, runs the exec process with extended privileges.
- **User** - A string value specifying the user, and optionally, group to run
the exec process inside the container. Format is one of: `"user"`,
`"user:group"`, `"uid"`, or `"uid:gid"`.
**Status codes**:
- **201** – no error
- **404** – no such container
- **409** - container is paused
- **500** - server error
#### Exec Start
`POST /exec/(id)/start`
Starts a previously set up `exec` instance `id`. If `detach` is true, this API
returns after starting the `exec` command. Otherwise, this API sets up an
interactive session with the `exec` command.
**Example request**:
POST /v1.24/exec/e90e34656806/start HTTP/1.1
Content-Type: application/json
Content-Length: 12345
{
"Detach": false,
"Tty": false
}
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{% raw %}
{{ STREAM }}
{% endraw %}
**JSON parameters**:
- **Detach** - Detach from the `exec` command.
- **Tty** - Boolean value to allocate a pseudo-TTY.
**Status codes**:
- **200** – no error
- **404** – no such exec instance
- **409** - container is paused
**Stream details**:
Similar to the stream behavior of `POST /containers/(id or name)/attach` API
#### Exec Resize
`POST /exec/(id)/resize`
Resizes the `tty` session used by the `exec` command `id`. The unit is number of characters.
This API is valid only if `tty` was specified as part of creating and starting the `exec` command.
**Example request**:
POST /v1.24/exec/e90e34656806/resize?h=40&w=80 HTTP/1.1
Content-Type: text/plain
**Example response**:
HTTP/1.1 201 Created
Content-Type: text/plain
**Query parameters**:
- **h** – height of `tty` session
- **w** – width
**Status codes**:
- **201** – no error
- **404** – no such exec instance
#### Exec Inspect
`GET /exec/(id)/json`
Return low-level information about the `exec` command `id`.
**Example request**:
GET /v1.24/exec/11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39/json HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{
"CanRemove": false,
"ContainerID": "b53ee82b53a40c7dca428523e34f741f3abc51d9f297a14ff874bf761b995126",
"DetachKeys": "",
"ExitCode": 2,
"ID": "f33bbfb39f5b142420f4759b2348913bd4a8d1a6d7fd56499cb41a1bb91d7b3b",
"OpenStderr": true,
"OpenStdin": true,
"OpenStdout": true,
"ProcessConfig": {
"arguments": [
"-c",
"exit 2"
],
"entrypoint": "sh",
"privileged": false,
"tty": true,
"user": "1000"
},
"Running": false
}
**Status codes**:
- **200** – no error
- **404** – no such exec instance
- **500** - server error
### 3.4 Volumes
#### List volumes
`GET /volumes`
**Example request**:
GET /v1.24/volumes HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{
"Volumes": [
{
"Name": "tardis",
"Driver": "local",
"Mountpoint": "/var/lib/docker/volumes/tardis",
"Labels": null,
"Scope": "local"
}
],
"Warnings": []
}
**Query parameters**:
- **filters** - JSON encoded value of the filters (a `map[string][]string`) to process on the volumes list. Available filters:
- `name=<volume-name>` Matches all or part of a volume name.
- `dangling=<boolean>` When set to `true` (or `1`), returns all volumes that are "dangling" (not in use by a container). When set to `false` (or `0`), only volumes that are in use by one or more containers are returned.
- `driver=<volume-driver-name>` Matches all or part of a volume driver name.
**Status codes**:
- **200** - no error
- **500** - server error
#### Create a volume
`POST /volumes/create`
Create a volume
**Example request**:
POST /v1.24/volumes/create HTTP/1.1
Content-Type: application/json
Content-Length: 12345
{
"Name": "tardis",
"Labels": {
"com.example.some-label": "some-value",
"com.example.some-other-label": "some-other-value"
},
"Driver": "custom"
}
**Example response**:
HTTP/1.1 201 Created
Content-Type: application/json
{
"Name": "tardis",
"Driver": "custom",
"Mountpoint": "/var/lib/docker/volumes/tardis",
"Status": {
"hello": "world"
},
"Labels": {
"com.example.some-label": "some-value",
"com.example.some-other-label": "some-other-value"
},
"Scope": "local"
}
**Status codes**:
- **201** - no error
- **500** - server error
**JSON parameters**:
- **Name** - The new volume's name. If not specified, Docker generates a name.
- **Driver** - Name of the volume driver to use. Defaults to `local` for the name.
- **DriverOpts** - A mapping of driver options and values. These options are
passed directly to the driver and are driver specific.
- **Labels** - Labels to set on the volume, specified as a map: `{"key":"value","key2":"value2"}`
**JSON fields in response**:
Refer to the [inspect a volume](#inspect-a-volume) section or details about the
JSON fields returned in the response.
#### Inspect a volume
`GET /volumes/(name)`
Return low-level information on the volume `name`
**Example request**:
GET /v1.24/volumes/tardis
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{
"Name": "tardis",
"Driver": "custom",
"Mountpoint": "/var/lib/docker/volumes/tardis/_data",
"Status": {
"hello": "world"
},
"Labels": {
"com.example.some-label": "some-value",
"com.example.some-other-label": "some-other-value"
},
"Scope": "local"
}
**Status codes**:
- **200** - no error
- **404** - no such volume
- **500** - server error
**JSON fields in response**:
The following fields can be returned in the API response. Empty fields, or
fields that are not supported by the volume's driver may be omitted in the
response.
- **Name** - Name of the volume.
- **Driver** - Name of the volume driver used by the volume.
- **Mountpoint** - Mount path of the volume on the host.
- **Status** - Low-level details about the volume, provided by the volume driver.
Details are returned as a map with key/value pairs: `{"key":"value","key2":"value2"}`.
The `Status` field is optional, and is omitted if the volume driver does not
support this feature.
- **Labels** - Labels set on the volume, specified as a map: `{"key":"value","key2":"value2"}`.
- **Scope** - Scope describes the level at which the volume exists, can be one of
`global` for cluster-wide or `local` for machine level. The default is `local`.
#### Remove a volume
`DELETE /volumes/(name)`
Instruct the driver to remove the volume (`name`).
**Example request**:
DELETE /v1.24/volumes/tardis HTTP/1.1
**Example response**:
HTTP/1.1 204 No Content
**Status codes**:
- **204** - no error
- **404** - no such volume or volume driver
- **409** - volume is in use and cannot be removed
- **500** - server error
### 3.5 Networks
#### List networks
`GET /networks`
**Example request**:
GET /v1.24/networks?filters={"type":{"custom":true}} HTTP/1.1
**Example response**:
```
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"Name": "bridge",
"Id": "f2de39df4171b0dc801e8002d1d999b77256983dfc63041c0f34030aa3977566",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"Internal": false,
"IPAM": {
"Driver": "default",
"Config": [
{
"Subnet": "172.17.0.0/16"
}
]
},
"Containers": {
"39b69226f9d79f5634485fb236a23b2fe4e96a0a94128390a7fbbcc167065867": {
"EndpointID": "ed2419a97c1d9954d05b46e462e7002ea552f216e9b136b80a7db8d98b442eda",
"MacAddress": "02:42:ac:11:00:02",
"IPv4Address": "172.17.0.2/16",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.driver.mtu": "1500"
}
},
{
"Name": "none",
"Id": "e086a3893b05ab69242d3c44e49483a3bbbd3a26b46baa8f61ab797c1088d794",
"Scope": "local",
"Driver": "null",
"EnableIPv6": false,
"Internal": false,
"IPAM": {
"Driver": "default",
"Config": []
},
"Containers": {},
"Options": {}
},
{
"Name": "host",
"Id": "13e871235c677f196c4e1ecebb9dc733b9b2d2ab589e30c539efeda84a24215e",
"Scope": "local",
"Driver": "host",
"EnableIPv6": false,
"Internal": false,
"IPAM": {
"Driver": "default",
"Config": []
},
"Containers": {},
"Options": {}
}
]
```
**Query parameters**:
- **filters** - JSON encoded network list filter. The filter value is one of:
- `driver=<driver-name>` Matches a network's driver.
- `id=<network-id>` Matches all or part of a network id.
- `label=<key>` or `label=<key>=<value>` of a network label.
- `name=<network-name>` Matches all or part of a network name.
- `type=["custom"|"builtin"]` Filters networks by type. The `custom` keyword returns all user-defined networks.
**Status codes**:
- **200** - no error
- **500** - server error
#### Inspect network
`GET /networks/(id or name)`
Return low-level information on the network `id`
**Example request**:
GET /v1.24/networks/7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99 HTTP/1.1
**Example response**:
```
HTTP/1.1 200 OK
Content-Type: application/json
{
"Name": "net01",
"Id": "7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Config": [
{
"Subnet": "172.19.0.0/16",
"Gateway": "172.19.0.1"
}
],
"Options": {
"foo": "bar"
}
},
"Internal": false,
"Containers": {
"19a4d5d687db25203351ed79d478946f861258f018fe384f229f2efa4b23513c": {
"Name": "test",
"EndpointID": "628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a",
"MacAddress": "02:42:ac:13:00:02",
"IPv4Address": "172.19.0.2/16",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.driver.mtu": "1500"
},
"Labels": {
"com.example.some-label": "some-value",
"com.example.some-other-label": "some-other-value"
}
}
```
**Status codes**:
- **200** - no error
- **404** - network not found
- **500** - server error
#### Create a network
`POST /networks/create`
Create a network
**Example request**:
```
POST /v1.24/networks/create HTTP/1.1
Content-Type: application/json
Content-Length: 12345
{
"Name":"isolated_nw",
"CheckDuplicate":true,
"Driver":"bridge",
"EnableIPv6": true,
"IPAM":{
"Driver": "default",
"Config":[
{
"Subnet":"172.20.0.0/16",
"IPRange":"172.20.10.0/24",
"Gateway":"172.20.10.11"
},
{
"Subnet":"2001:db8:abcd::/64",
"Gateway":"2001:db8:abcd::1011"
}
],
"Options": {
"foo": "bar"
}
},
"Internal":true,
"Options": {
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.driver.mtu": "1500"
},
"Labels": {
"com.example.some-label": "some-value",
"com.example.some-other-label": "some-other-value"
}
}
```
**Example response**:
```
HTTP/1.1 201 Created
Content-Type: application/json
{
"Id": "22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30",
"Warning": ""
}
```
**Status codes**:
- **201** - no error
- **403** - operation not supported for pre-defined networks
- **404** - plugin not found
- **500** - server error
**JSON parameters**:
- **Name** - The new network's name. this is a mandatory field
- **CheckDuplicate** - Requests daemon to check for networks with same name. Defaults to `false`.
Since Network is primarily keyed based on a random ID and not on the name,
and network name is strictly a user-friendly alias to the network
which is uniquely identified using ID, there is no guaranteed way to check for duplicates.
This parameter CheckDuplicate is there to provide a best effort checking of any networks
which has the same name but it is not guaranteed to catch all name collisions.
- **Driver** - Name of the network driver plugin to use. Defaults to `bridge` driver
- **Internal** - Restrict external access to the network
- **IPAM** - Optional custom IP scheme for the network
- **Driver** - Name of the IPAM driver to use. Defaults to `default` driver
- **Config** - List of IPAM configuration options, specified as a map:
`{"Subnet": <CIDR>, "IPRange": <CIDR>, "Gateway": <IP address>, "AuxAddress": <device_name:IP address>}`
- **Options** - Driver-specific options, specified as a map: `{"option":"value" [,"option2":"value2"]}`
- **EnableIPv6** - Enable IPv6 on the network
- **Options** - Network specific options to be used by the drivers
- **Labels** - Labels to set on the network, specified as a map: `{"key":"value" [,"key2":"value2"]}`
#### Connect a container to a network
`POST /networks/(id or name)/connect`
Connect a container to a network
**Example request**:
```
POST /v1.24/networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/connect HTTP/1.1
Content-Type: application/json
Content-Length: 12345
{
"Container":"3613f73ba0e4",
"EndpointConfig": {
"IPAMConfig": {
"IPv4Address":"172.24.56.89",
"IPv6Address":"2001:db8::5689"
}
}
}
```
**Example response**:
HTTP/1.1 200 OK
**Status codes**:
- **200** - no error
- **403** - operation not supported for swarm scoped networks
- **404** - network or container is not found
- **500** - Internal Server Error
**JSON parameters**:
- **container** - container-id/name to be connected to the network
#### Disconnect a container from a network
`POST /networks/(id or name)/disconnect`
Disconnect a container from a network
**Example request**:
```
POST /v1.24/networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/disconnect HTTP/1.1
Content-Type: application/json
Content-Length: 12345
{
"Container":"3613f73ba0e4",
"Force":false
}
```
**Example response**:
HTTP/1.1 200 OK
**Status codes**:
- **200** - no error
- **403** - operation not supported for swarm scoped networks
- **404** - network or container not found
- **500** - Internal Server Error
**JSON parameters**:
- **Container** - container-id/name to be disconnected from a network
- **Force** - Force the container to disconnect from a network
#### Remove a network
`DELETE /networks/(id or name)`
Instruct the driver to remove the network (`id`).
**Example request**:
DELETE /v1.24/networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30 HTTP/1.1
**Example response**:
HTTP/1.1 204 No Content
**Status codes**:
- **204** - no error
- **403** - operation not supported for pre-defined networks
- **404** - no such network
- **500** - server error
### 3.6 Plugins (experimental)
#### List plugins
`GET /plugins`
Returns information about installed plugins.
**Example request**:
GET /v1.24/plugins HTTP/1.1
**Example response**:
```
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"Id": "5724e2c8652da337ab2eedd19fc6fc0ec908e4bd907c7421bf6a8dfc70c4c078",
"Name": "tiborvass/no-remove",
"Tag": "latest",
"Active": true,
"Config": {
"Mounts": [
{
"Name": "",
"Description": "",
"Settable": null,
"Source": "/data",
"Destination": "/data",
"Type": "bind",
"Options": [
"shared",
"rbind"
]
},
{
"Name": "",
"Description": "",
"Settable": null,
"Source": null,
"Destination": "/foobar",
"Type": "tmpfs",
"Options": null
}
],
"Env": [
"DEBUG=1"
],
"Args": null,
"Devices": null
},
"Manifest": {
"ManifestVersion": "v0",
"Description": "A test plugin for Docker",
"Documentation": "https://docs.docker.com/engine/extend/plugins/",
"Interface": {
"Types": [
"docker.volumedriver/1.0"
],
"Socket": "plugins.sock"
},
"Entrypoint": [
"plugin-no-remove",
"/data"
],
"Workdir": "",
"User": {
},
"Network": {
"Type": "host"
},
"Capabilities": null,
"Mounts": [
{
"Name": "",
"Description": "",
"Settable": null,
"Source": "/data",
"Destination": "/data",
"Type": "bind",
"Options": [
"shared",
"rbind"
]
},
{
"Name": "",
"Description": "",
"Settable": null,
"Source": null,
"Destination": "/foobar",
"Type": "tmpfs",
"Options": null
}
],
"Devices": [
{
"Name": "device",
"Description": "a host device to mount",
"Settable": null,
"Path": "/dev/cpu_dma_latency"
}
],
"Env": [
{
"Name": "DEBUG",
"Description": "If set, prints debug messages",
"Settable": null,
"Value": "1"
}
],
"Args": {
"Name": "args",
"Description": "command line arguments",
"Settable": null,
"Value": [
]
}
}
}
]
```
**Status codes**:
- **200** - no error
- **500** - server error
#### Install a plugin
`POST /plugins/pull?name=<plugin name>`
Pulls and installs a plugin. After the plugin is installed, it can be enabled
using the [`POST /plugins/(plugin name)/enable` endpoint](#enable-a-plugin).
**Example request**:
```
POST /v1.24/plugins/pull?name=tiborvass/no-remove:latest HTTP/1.1
```
The `:latest` tag is optional, and is used as default if omitted. When using
this endpoint to pull a plugin from the registry, the `X-Registry-Auth` header
can be used to include a base64-encoded AuthConfig object. Refer to the [create
an image](#create-an-image) section for more details.
**Example response**:
```
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 175
[
{
"Name": "network",
"Description": "",
"Value": [
"host"
]
},
{
"Name": "mount",
"Description": "",
"Value": [
"/data"
]
},
{
"Name": "device",
"Description": "",
"Value": [
"/dev/cpu_dma_latency"
]
}
]
```
**Query parameters**:
- **name** - Name of the plugin to pull. The name may include a tag or digest.
This parameter is required.
**Status codes**:
- **200** - no error
- **500** - error parsing reference / not a valid repository/tag: repository
name must have at least one component
- **500** - plugin already exists
#### Inspect a plugin
`GET /plugins/(plugin name)`
Returns detailed information about an installed plugin.
**Example request**:
```
GET /v1.24/plugins/tiborvass/no-remove:latest HTTP/1.1
```
The `:latest` tag is optional, and is used as default if omitted.
**Example response**:
```
HTTP/1.1 200 OK
Content-Type: application/json
{
"Id": "5724e2c8652da337ab2eedd19fc6fc0ec908e4bd907c7421bf6a8dfc70c4c078",
"Name": "tiborvass/no-remove",
"Tag": "latest",
"Active": false,
"Config": {
"Mounts": [
{
"Name": "",
"Description": "",
"Settable": null,
"Source": "/data",
"Destination": "/data",
"Type": "bind",
"Options": [
"shared",
"rbind"
]
},
{
"Name": "",
"Description": "",
"Settable": null,
"Source": null,
"Destination": "/foobar",
"Type": "tmpfs",
"Options": null
}
],
"Env": [
"DEBUG=1"
],
"Args": null,
"Devices": null
},
"Manifest": {
"ManifestVersion": "v0",
"Description": "A test plugin for Docker",
"Documentation": "https://docs.docker.com/engine/extend/plugins/",
"Interface": {
"Types": [
"docker.volumedriver/1.0"
],
"Socket": "plugins.sock"
},
"Entrypoint": [
"plugin-no-remove",
"/data"
],
"Workdir": "",
"User": {
},
"Network": {
"Type": "host"
},
"Capabilities": null,
"Mounts": [
{
"Name": "",
"Description": "",
"Settable": null,
"Source": "/data",
"Destination": "/data",
"Type": "bind",
"Options": [
"shared",
"rbind"
]
},
{
"Name": "",
"Description": "",
"Settable": null,
"Source": null,
"Destination": "/foobar",
"Type": "tmpfs",
"Options": null
}
],
"Devices": [
{
"Name": "device",
"Description": "a host device to mount",
"Settable": null,
"Path": "/dev/cpu_dma_latency"
}
],
"Env": [
{
"Name": "DEBUG",
"Description": "If set, prints debug messages",
"Settable": null,
"Value": "1"
}
],
"Args": {
"Name": "args",
"Description": "command line arguments",
"Settable": null,
"Value": [
]
}
}
}
```
**Status codes**:
- **200** - no error
- **404** - plugin not installed
#### Enable a plugin
`POST /plugins/(plugin name)/enable`
Enables a plugin
**Example request**:
```
POST /v1.24/plugins/tiborvass/no-remove:latest/enable HTTP/1.1
```
The `:latest` tag is optional, and is used as default if omitted.
**Example response**:
```
HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/plain; charset=utf-8
```
**Status codes**:
- **200** - no error
- **404** - plugin not installed
- **500** - plugin is already enabled
#### Disable a plugin
`POST /plugins/(plugin name)/disable`
Disables a plugin
**Example request**:
```
POST /v1.24/plugins/tiborvass/no-remove:latest/disable HTTP/1.1
```
The `:latest` tag is optional, and is used as default if omitted.
**Example response**:
```
HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/plain; charset=utf-8
```
**Status codes**:
- **200** - no error
- **404** - plugin not installed
- **500** - plugin is already disabled
#### Remove a plugin
`DELETE /plugins/(plugin name)`
Removes a plugin
**Example request**:
```
DELETE /v1.24/plugins/tiborvass/no-remove:latest HTTP/1.1
```
The `:latest` tag is optional, and is used as default if omitted.
**Example response**:
```
HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/plain; charset=utf-8
```
**Status codes**:
- **200** - no error
- **404** - plugin not installed
- **500** - plugin is active
<!-- TODO Document "docker plugin push" endpoint once we have "plugin build"
#### Push a plugin
`POST /v1.24/plugins/tiborvass/(plugin name)/push HTTP/1.1`
Pushes a plugin to the registry.
**Example request**:
```
POST /v1.24/plugins/tiborvass/no-remove:latest HTTP/1.1
```
The `:latest` tag is optional, and is used as default if omitted. When using
this endpoint to push a plugin to the registry, the `X-Registry-Auth` header
can be used to include a base64-encoded AuthConfig object. Refer to the [create
an image](#create-an-image) section for more details.
**Example response**:
**Status codes**:
- **200** - no error
- **404** - plugin not installed
-->
### 3.7 Nodes
**Note**: Node operations require the engine to be part of a swarm.
#### List nodes
`GET /nodes`
List nodes
**Example request**:
GET /v1.24/nodes HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"ID": "24ifsmvkjbyhk",
"Version": {
"Index": 8
},
"CreatedAt": "2016-06-07T20:31:11.853781916Z",
"UpdatedAt": "2016-06-07T20:31:11.999868824Z",
"Spec": {
"Name": "my-node",
"Role": "manager",
"Availability": "active"
"Labels": {
"foo": "bar"
}
},
"Description": {
"Hostname": "bf3067039e47",
"Platform": {
"Architecture": "x86_64",
"OS": "linux"
},
"Resources": {
"NanoCPUs": 4000000000,
"MemoryBytes": 8272408576
},
"Engine": {
"EngineVersion": "1.12.0",
"Labels": {
"foo": "bar",
}
"Plugins": [
{
"Type": "Volume",
"Name": "local"
},
{
"Type": "Network",
"Name": "bridge"
}
{
"Type": "Network",
"Name": "null"
}
{
"Type": "Network",
"Name": "overlay"
}
]
}
},
"Status": {
"State": "ready"
},
"ManagerStatus": {
"Leader": true,
"Reachability": "reachable",
"Addr": "172.17.0.2:2377""
}
}
]
**Query parameters**:
- **filters** – a JSON encoded value of the filters (a `map[string][]string`) to process on the
nodes list. Available filters:
- `id=<node id>`
- `label=<engine label>`
- `membership=`(`accepted`|`pending`)`
- `name=<node name>`
- `role=`(`manager`|`worker`)`
**Status codes**:
- **200** – no error
- **406** - node is not part of a swarm
- **500** – server error
#### Inspect a node
`GET /nodes/(id or name)`
Return low-level information on the node `id`
**Example request**:
GET /v1.24/nodes/24ifsmvkjbyhk HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{
"ID": "24ifsmvkjbyhk",
"Version": {
"Index": 8
},
"CreatedAt": "2016-06-07T20:31:11.853781916Z",
"UpdatedAt": "2016-06-07T20:31:11.999868824Z",
"Spec": {
"Name": "my-node",
"Role": "manager",
"Availability": "active"
"Labels": {
"foo": "bar"
}
},
"Description": {
"Hostname": "bf3067039e47",
"Platform": {
"Architecture": "x86_64",
"OS": "linux"
},
"Resources": {
"NanoCPUs": 4000000000,
"MemoryBytes": 8272408576
},
"Engine": {
"EngineVersion": "1.12.0",
"Labels": {
"foo": "bar",
}
"Plugins": [
{
"Type": "Volume",
"Name": "local"
},
{
"Type": "Network",
"Name": "bridge"
}
{
"Type": "Network",
"Name": "null"
}
{
"Type": "Network",
"Name": "overlay"
}
]
}
},
"Status": {
"State": "ready"
},
"ManagerStatus": {
"Leader": true,
"Reachability": "reachable",
"Addr": "172.17.0.2:2377""
}
}
**Status codes**:
- **200** – no error
- **404** – no such node
- **406** – node is not part of a swarm
- **500** – server error
#### Remove a node
`DELETE /nodes/(id or name)`
Remove a node from the swarm.
**Example request**:
DELETE /v1.24/nodes/24ifsmvkjbyhk HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/plain; charset=utf-8
**Query parameters**:
- **force** - 1/True/true or 0/False/false, Force remove a node from the swarm.
Default `false`.
**Status codes**:
- **200** – no error
- **404** – no such node
- **406** – node is not part of a swarm
- **500** – server error
#### Update a node
`POST /nodes/(id)/update`
Update a node.
The payload of the `POST` request is the new `NodeSpec` and
overrides the current `NodeSpec` for the specified node.
If `Availability` or `Role` are omitted, this returns an
error. Any other field omitted resets the current value to either
an empty value or the default cluster-wide value.
**Example Request**
POST /v1.24/nodes/24ifsmvkjbyhk/update?version=8 HTTP/1.1
Content-Type: application/json
Content-Length: 12345
{
"Availability": "active",
"Name": "node-name",
"Role": "manager",
"Labels": {
"foo": "bar"
}
}
**Example response**:
HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/plain; charset=utf-8
**Query parameters**:
- **version** – The version number of the node object being updated. This is
required to avoid conflicting writes.
JSON Parameters:
- **Annotations** – Optional medata to associate with the node.
- **Name** – User-defined name for the node.
- **Labels** – A map of labels to associate with the node (e.g.,
`{"key":"value", "key2":"value2"}`).
- **Role** - Role of the node (worker|manager).
- **Availability** - Availability of the node (active|pause|drain).
**Status codes**:
- **200** – no error
- **404** – no such node
- **406** – node is not part of a swarm
- **500** – server error
### 3.8 Swarm
#### Inspect swarm
`GET /swarm`
Inspect swarm
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{
"CreatedAt" : "2016-08-15T16:00:20.349727406Z",
"Spec" : {
"Dispatcher" : {
"HeartbeatPeriod" : 5000000000
},
"Orchestration" : {
"TaskHistoryRetentionLimit" : 10
},
"CAConfig" : {
"NodeCertExpiry" : 7776000000000000
},
"Raft" : {
"LogEntriesForSlowFollowers" : 500,
"HeartbeatTick" : 1,
"SnapshotInterval" : 10000,
"ElectionTick" : 3
},
"TaskDefaults" : {},
"Name" : "default"
},
"JoinTokens" : {
"Worker" : "SWMTKN-1-1h8aps2yszaiqmz2l3oc5392pgk8e49qhx2aj3nyv0ui0hez2a-6qmn92w6bu3jdvnglku58u11a",
"Manager" : "SWMTKN-1-1h8aps2yszaiqmz2l3oc5392pgk8e49qhx2aj3nyv0ui0hez2a-8llk83c4wm9lwioey2s316r9l"
},
"ID" : "70ilmkj2f6sp2137c753w2nmt",
"UpdatedAt" : "2016-08-15T16:32:09.623207604Z",
"Version" : {
"Index" : 51
}
}
**Status codes**:
- **200** - no error
- **406** – node is not part of a swarm
- **500** - sever error
#### Initialize a new swarm
`POST /swarm/init`
Initialize a new swarm. The body of the HTTP response includes the node ID.
**Example request**:
POST /v1.24/swarm/init HTTP/1.1
Content-Type: application/json
Content-Length: 12345
{
"ListenAddr": "0.0.0.0:2377",
"AdvertiseAddr": "192.168.1.1:2377",
"ForceNewCluster": false,
"Spec": {
"Orchestration": {},
"Raft": {},
"Dispatcher": {},
"CAConfig": {}
}
}
**Example response**:
HTTP/1.1 200 OK
Content-Length: 28
Content-Type: application/json
Date: Thu, 01 Sep 2016 21:49:13 GMT
Server: Docker/1.12.0 (linux)
"7v2t30z9blmxuhnyo6s4cpenp"
**Status codes**:
- **200** – no error
- **400** – bad parameter
- **406** – node is already part of a swarm
- **500** - server error
JSON Parameters:
- **ListenAddr** – Listen address used for inter-manager communication, as well as determining
the networking interface used for the VXLAN Tunnel Endpoint (VTEP). This can either be an
address/port combination in the form `192.168.1.1:4567`, or an interface followed by a port
number, like `eth0:4567`. If the port number is omitted, the default swarm listening port is
used.
- **AdvertiseAddr** – Externally reachable address advertised to other nodes. This can either be
an address/port combination in the form `192.168.1.1:4567`, or an interface followed by a port
number, like `eth0:4567`. If the port number is omitted, the port number from the listen
address is used. If `AdvertiseAddr` is not specified, it will be automatically detected when
possible.
- **ForceNewCluster** – Force creation of a new swarm.
- **Spec** – Configuration settings for the new swarm.
- **Orchestration** – Configuration settings for the orchestration aspects of the swarm.
- **TaskHistoryRetentionLimit** – Maximum number of tasks history stored.
- **Raft** – Raft related configuration.
- **SnapshotInterval** – Number of logs entries between snapshot.
- **KeepOldSnapshots** – Number of snapshots to keep beyond the current snapshot.
- **LogEntriesForSlowFollowers** – Number of log entries to keep around to sync up slow
followers after a snapshot is created.
- **HeartbeatTick** – Amount of ticks (in seconds) between each heartbeat.
- **ElectionTick** – Amount of ticks (in seconds) needed without a leader to trigger a new
election.
- **Dispatcher** – Configuration settings for the task dispatcher.
- **HeartbeatPeriod** – The delay for an agent to send a heartbeat to the dispatcher.
- **CAConfig** – Certificate authority configuration.
- **NodeCertExpiry** – Automatic expiry for nodes certificates.
- **ExternalCA** - Configuration for forwarding signing requests to an external
certificate authority.
- **Protocol** - Protocol for communication with the external CA
(currently only "cfssl" is supported).
- **URL** - URL where certificate signing requests should be sent.
- **Options** - An object with key/value pairs that are interpreted
as protocol-specific options for the external CA driver.
#### Join an existing swarm
`POST /swarm/join`
Join an existing swarm
**Example request**:
POST /v1.24/swarm/join HTTP/1.1
Content-Type: application/json
{
"ListenAddr": "0.0.0.0:2377",
"AdvertiseAddr": "192.168.1.1:2377",
"RemoteAddrs": ["node1:2377"],
"JoinToken": "SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2"
}
**Example response**:
HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/plain; charset=utf-8
**Status codes**:
- **200** – no error
- **400** – bad parameter
- **406** – node is already part of a swarm
- **500** - server error
JSON Parameters:
- **ListenAddr** – Listen address used for inter-manager communication if the node gets promoted to
manager, as well as determining the networking interface used for the VXLAN Tunnel Endpoint (VTEP).
- **AdvertiseAddr** – Externally reachable address advertised to other nodes. This can either be
an address/port combination in the form `192.168.1.1:4567`, or an interface followed by a port
number, like `eth0:4567`. If the port number is omitted, the port number from the listen
address is used. If `AdvertiseAddr` is not specified, it will be automatically detected when
possible.
- **RemoteAddr** – Address of any manager node already participating in the swarm.
- **JoinToken** – Secret token for joining this swarm.
#### Leave a swarm
`POST /swarm/leave`
Leave a swarm
**Example request**:
POST /v1.24/swarm/leave HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/plain; charset=utf-8
**Query parameters**:
- **force** - Boolean (0/1, false/true). Force leave swarm, even if this is the last manager or that it will break the cluster.
**Status codes**:
- **200** – no error
- **406** – node is not part of a swarm
- **500** - server error
#### Update a swarm
`POST /swarm/update`
Update a swarm
**Example request**:
POST /v1.24/swarm/update HTTP/1.1
Content-Length: 12345
{
"Name": "default",
"Orchestration": {
"TaskHistoryRetentionLimit": 10
},
"Raft": {
"SnapshotInterval": 10000,
"LogEntriesForSlowFollowers": 500,
"HeartbeatTick": 1,
"ElectionTick": 3
},
"Dispatcher": {
"HeartbeatPeriod": 5000000000
},
"CAConfig": {
"NodeCertExpiry": 7776000000000000
},
"JoinTokens": {
"Worker": "SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx",
"Manager": "SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2"
}
}
**Example response**:
HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/plain; charset=utf-8
**Query parameters**:
- **version** – The version number of the swarm object being updated. This is
required to avoid conflicting writes.
- **rotateWorkerToken** - Set to `true` (or `1`) to rotate the worker join token.
- **rotateManagerToken** - Set to `true` (or `1`) to rotate the manager join token.
**Status codes**:
- **200** – no error
- **400** – bad parameter
- **406** – node is not part of a swarm
- **500** - server error
JSON Parameters:
- **Orchestration** – Configuration settings for the orchestration aspects of the swarm.
- **TaskHistoryRetentionLimit** – Maximum number of tasks history stored.
- **Raft** – Raft related configuration.
- **SnapshotInterval** – Number of logs entries between snapshot.
- **KeepOldSnapshots** – Number of snapshots to keep beyond the current snapshot.
- **LogEntriesForSlowFollowers** – Number of log entries to keep around to sync up slow
followers after a snapshot is created.
- **HeartbeatTick** – Amount of ticks (in seconds) between each heartbeat.
- **ElectionTick** – Amount of ticks (in seconds) needed without a leader to trigger a new
election.
- **Dispatcher** – Configuration settings for the task dispatcher.
- **HeartbeatPeriod** – The delay for an agent to send a heartbeat to the dispatcher.
- **CAConfig** – CA configuration.
- **NodeCertExpiry** – Automatic expiry for nodes certificates.
- **ExternalCA** - Configuration for forwarding signing requests to an external
certificate authority.
- **Protocol** - Protocol for communication with the external CA
(currently only "cfssl" is supported).
- **URL** - URL where certificate signing requests should be sent.
- **Options** - An object with key/value pairs that are interpreted
as protocol-specific options for the external CA driver.
- **JoinTokens** - Tokens that can be used by other nodes to join the swarm.
- **Worker** - Token to use for joining as a worker.
- **Manager** - Token to use for joining as a manager.
### 3.9 Services
**Note**: Service operations require to first be part of a swarm.
#### List services
`GET /services`
List services
**Example request**:
GET /v1.24/services HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"ID": "9mnpnzenvg8p8tdbtq4wvbkcz",
"Version": {
"Index": 19
},
"CreatedAt": "2016-06-07T21:05:51.880065305Z",
"UpdatedAt": "2016-06-07T21:07:29.962229872Z",
"Spec": {
"Name": "hopeful_cori",
"TaskTemplate": {
"ContainerSpec": {
"Image": "redis"
},
"Resources": {
"Limits": {},
"Reservations": {}
},
"RestartPolicy": {
"Condition": "any",
"MaxAttempts": 0
},
"Placement": {
"Constraints": [
"node.role == worker"
]
}
},
"Mode": {
"Replicated": {
"Replicas": 1
}
},
"UpdateConfig": {
"Parallelism": 1,
"FailureAction": "pause"
},
"EndpointSpec": {
"Mode": "vip",
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 6379,
"PublishedPort": 30001
}
]
}
},
"Endpoint": {
"Spec": {
"Mode": "vip",
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 6379,
"PublishedPort": 30001
}
]
},
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 6379,
"PublishedPort": 30001
}
],
"VirtualIPs": [
{
"NetworkID": "4qvuz4ko70xaltuqbt8956gd1",
"Addr": "10.255.0.2/16"
},
{
"NetworkID": "4qvuz4ko70xaltuqbt8956gd1",
"Addr": "10.255.0.3/16"
}
]
}
}
]
**Query parameters**:
- **filters** – a JSON encoded value of the filters (a `map[string][]string`) to process on the
services list. Available filters:
- `id=<service id>`
- `label=<service label>`
- `name=<service name>`
**Status codes**:
- **200** – no error
- **406** – node is not part of a swarm
- **500** – server error
#### Create a service
`POST /services/create`
Create a service. When using this endpoint to create a service using a private
repository from the registry, the `X-Registry-Auth` header must be used to
include a base64-encoded AuthConfig object. Refer to the [create an
image](#create-an-image) section for more details.
**Example request**:
POST /v1.24/services/create HTTP/1.1
Content-Type: application/json
Content-Length: 12345
{
"Name": "web",
"TaskTemplate": {
"ContainerSpec": {
"Image": "nginx:alpine",
"Mounts": [
{
"ReadOnly": true,
"Source": "web-data",
"Target": "/usr/share/nginx/html",
"Type": "volume",
"VolumeOptions": {
"DriverConfig": {
},
"Labels": {
"com.example.something": "something-value"
}
}
}
],
"User": "33"
},
"Networks": [
{
"Target": "overlay1"
}
],
"LogDriver": {
"Name": "json-file",
"Options": {
"max-file": "3",
"max-size": "10M"
}
},
"Placement": {
"Constraints": [
"node.role == worker"
]
},
"Resources": {
"Limits": {
"MemoryBytes": 104857600
},
"Reservations": {
}
},
"RestartPolicy": {
"Condition": "on-failure",
"Delay": 10000000000,
"MaxAttempts": 10
}
},
"Mode": {
"Replicated": {
"Replicas": 4
}
},
"UpdateConfig": {
"Delay": 30000000000,
"Parallelism": 2,
"FailureAction": "pause"
},
"EndpointSpec": {
"Ports": [
{
"Protocol": "tcp",
"PublishedPort": 8080,
"TargetPort": 80
}
]
},
"Labels": {
"foo": "bar"
}
}
**Example response**:
HTTP/1.1 201 Created
Content-Type: application/json
{
"ID":"ak7w3gjqoa3kuz8xcpnyy0pvl"
}
**Status codes**:
- **201** – no error
- **403** - network is not eligible for services
- **406** – node is not part of a swarm
- **409** – name conflicts with an existing object
- **500** - server error
**JSON Parameters**:
- **Name** – User-defined name for the service.
- **Labels** – A map of labels to associate with the service (e.g., `{"key":"value", "key2":"value2"}`).
- **TaskTemplate** – Specification of the tasks to start as part of the new service.
- **ContainerSpec** - Container settings for containers started as part of this task.
- **Image** – A string specifying the image name to use for the container.
- **Command** – The command to be run in the image.
- **Args** – Arguments to the command.
- **Env** – A list of environment variables in the form of `["VAR=value"[,"VAR2=value2"]]`.
- **Dir** – A string specifying the working directory for commands to run in.
- **User** – A string value specifying the user inside the container.
- **Labels** – A map of labels to associate with the service (e.g.,
`{"key":"value", "key2":"value2"}`).
- **Mounts** – Specification for mounts to be added to containers
created as part of the service.
- **Target** – Container path.
- **Source** – Mount source (e.g. a volume name, a host path).
- **Type** – The mount type (`bind`, or `volume`).
- **ReadOnly** – A boolean indicating whether the mount should be read-only.
- **BindOptions** - Optional configuration for the `bind` type.
- **Propagation** – A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.
- **VolumeOptions** – Optional configuration for the `volume` type.
- **NoCopy** – A boolean indicating if volume should be
populated with the data from the target. (Default false)
- **Labels** – User-defined name and labels for the volume.
- **DriverConfig** – Map of driver-specific options.
- **Name** - Name of the driver to use to create the volume.
- **Options** - key/value map of driver specific options.
- **StopGracePeriod** – Amount of time to wait for the container to terminate before
forcefully killing it.
- **LogDriver** - Log configuration for containers created as part of the
service.
- **Name** - Name of the logging driver to use (`json-file`, `syslog`,
`journald`, `gelf`, `fluentd`, `awslogs`, `splunk`, `etwlogs`, `none`).
- **Options** - Driver-specific options.
- **Resources** – Resource requirements which apply to each individual container created as part
of the service.
- **Limits** – Define resources limits.
- **NanoCPUs** – CPU limit in units of 10<sup>-9</sup> CPU shares.
- **MemoryBytes** – Memory limit in Bytes.
- **Reservation** – Define resources reservation.
- **NanoCPUs** – CPU reservation in units of 10<sup>-9</sup> CPU shares.
- **MemoryBytes** – Memory reservation in Bytes.
- **RestartPolicy** – Specification for the restart policy which applies to containers created
as part of this service.
- **Condition** – Condition for restart (`none`, `on-failure`, or `any`).
- **Delay** – Delay between restart attempts.
- **MaxAttempts** – Maximum attempts to restart a given container before giving up (default value
is 0, which is ignored).
- **Window** – Windows is the time window used to evaluate the restart policy (default value is
0, which is unbounded).
- **Placement** – Restrictions on where a service can run.
- **Constraints** – An array of constraints, e.g. `[ "node.role == manager" ]`.
- **Mode** – Scheduling mode for the service (`replicated` or `global`, defaults to `replicated`).
- **UpdateConfig** – Specification for the update strategy of the service.
- **Parallelism** – Maximum number of tasks to be updated in one iteration (0 means unlimited
parallelism).
- **Delay** – Amount of time between updates.
- **FailureAction** - Action to take if an updated task fails to run, or stops running during the
update. Values are `continue` and `pause`.
- **Networks** – Array of network names or IDs to attach the service to.
- **EndpointSpec** – Properties that can be configured to access and load balance a service.
- **Mode** – The mode of resolution to use for internal load balancing
between tasks (`vip` or `dnsrr`). Defaults to `vip` if not provided.
- **Ports** – List of exposed ports that this service is accessible on from
the outside, in the form of:
`{"Protocol": <"tcp"|"udp">, "PublishedPort": <port>, "TargetPort": <port>}`.
Ports can only be provided if `vip` resolution mode is used.
**Request Headers**:
- **Content-type** – Set to `"application/json"`.
- **X-Registry-Auth** – base64-encoded AuthConfig object, containing either
login information, or a token. Refer to the [create an image](#create-an-image)
section for more details.
#### Remove a service
`DELETE /services/(id or name)`
Stop and remove the service `id`
**Example request**:
DELETE /v1.24/services/16253994b7c4 HTTP/1.1
**Example response**:
HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/plain; charset=utf-8
**Status codes**:
- **200** – no error
- **404** – no such service
- **406** - node is not part of a swarm
- **500** – server error
#### Inspect one or more services
`GET /services/(id or name)`
Return information on the service `id`.
**Example request**:
GET /v1.24/services/1cb4dnqcyx6m66g2t538x3rxha HTTP/1.1
**Example response**:
{
"ID": "ak7w3gjqoa3kuz8xcpnyy0pvl",
"Version": {
"Index": 95
},
"CreatedAt": "2016-06-07T21:10:20.269723157Z",
"UpdatedAt": "2016-06-07T21:10:20.276301259Z",
"Spec": {
"Name": "redis",
"TaskTemplate": {
"ContainerSpec": {
"Image": "redis"
},
"Resources": {
"Limits": {},
"Reservations": {}
},
"RestartPolicy": {
"Condition": "any",
"MaxAttempts": 0
},
"Placement": {}
},
"Mode": {
"Replicated": {
"Replicas": 1
}
},
"UpdateConfig": {
"Parallelism": 1,
"FailureAction": "pause"
},
"EndpointSpec": {
"Mode": "vip",
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 6379,
"PublishedPort": 30001
}
]
}
},
"Endpoint": {
"Spec": {
"Mode": "vip",
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 6379,
"PublishedPort": 30001
}
]
},
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 6379,
"PublishedPort": 30001
}
],
"VirtualIPs": [
{
"NetworkID": "4qvuz4ko70xaltuqbt8956gd1",
"Addr": "10.255.0.4/16"
}
]
}
}
**Status codes**:
- **200** – no error
- **404** – no such service
- **406** - node is not part of a swarm
- **500** – server error
#### Update a service
`POST /services/(id)/update`
Update a service. When using this endpoint to create a service using a
private repository from the registry, the `X-Registry-Auth` header can be used
to update the authentication information for that is stored for the service.
The header contains a base64-encoded AuthConfig object. Refer to the [create an
image](#create-an-image) section for more details.
**Example request**:
POST /v1.24/services/1cb4dnqcyx6m66g2t538x3rxha/update?version=23 HTTP/1.1
Content-Type: application/json
Content-Length: 12345
{
"Name": "top",
"TaskTemplate": {
"ContainerSpec": {
"Image": "busybox",
"Args": [
"top"
]
},
"Resources": {
"Limits": {},
"Reservations": {}
},
"RestartPolicy": {
"Condition": "any",
"MaxAttempts": 0
},
"Placement": {}
},
"Mode": {
"Replicated": {
"Replicas": 1
}
},
"UpdateConfig": {
"Parallelism": 1
},
"EndpointSpec": {
"Mode": "vip"
}
}
**Example response**:
HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/plain; charset=utf-8
**JSON Parameters**:
- **Name** – User-defined name for the service. Note that renaming services is not supported.
- **Labels** – A map of labels to associate with the service (e.g., `{"key":"value", "key2":"value2"}`).
- **TaskTemplate** – Specification of the tasks to start as part of the new service.
- **ContainerSpec** - Container settings for containers started as part of this task.
- **Image** – A string specifying the image name to use for the container.
- **Command** – The command to be run in the image.
- **Args** – Arguments to the command.
- **Env** – A list of environment variables in the form of `["VAR=value"[,"VAR2=value2"]]`.
- **Dir** – A string specifying the working directory for commands to run in.
- **User** – A string value specifying the user inside the container.
- **Labels** – A map of labels to associate with the service (e.g.,
`{"key":"value", "key2":"value2"}`).
- **Mounts** – Specification for mounts to be added to containers created as part of the new
service.
- **Target** – Container path.
- **Source** – Mount source (e.g. a volume name, a host path).
- **Type** – The mount type (`bind`, or `volume`).
- **ReadOnly** – A boolean indicating whether the mount should be read-only.
- **BindOptions** - Optional configuration for the `bind` type
- **Propagation** – A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.
- **VolumeOptions** – Optional configuration for the `volume` type.
- **NoCopy** – A boolean indicating if volume should be
populated with the data from the target. (Default false)
- **Labels** – User-defined name and labels for the volume.
- **DriverConfig** – Map of driver-specific options.
- **Name** - Name of the driver to use to create the volume
- **Options** - key/value map of driver specific options
- **StopGracePeriod** – Amount of time to wait for the container to terminate before
forcefully killing it.
- **Resources** – Resource requirements which apply to each individual container created as part
of the service.
- **Limits** – Define resources limits.
- **CPU** – CPU limit
- **Memory** – Memory limit
- **Reservation** – Define resources reservation.
- **CPU** – CPU reservation
- **Memory** – Memory reservation
- **RestartPolicy** – Specification for the restart policy which applies to containers created
as part of this service.
- **Condition** – Condition for restart (`none`, `on-failure`, or `any`).
- **Delay** – Delay between restart attempts.
- **MaxAttempts** – Maximum attempts to restart a given container before giving up (default value
is 0, which is ignored).
- **Window** – Windows is the time window used to evaluate the restart policy (default value is
0, which is unbounded).
- **Placement** – Restrictions on where a service can run.
- **Constraints** – An array of constraints, e.g. `[ "node.role == manager" ]`.
- **Mode** – Scheduling mode for the service (`replicated` or `global`, defaults to `replicated`).
- **UpdateConfig** – Specification for the update strategy of the service.
- **Parallelism** – Maximum number of tasks to be updated in one iteration (0 means unlimited
parallelism).
- **Delay** – Amount of time between updates.
- **Networks** – Array of network names or IDs to attach the service to.
- **EndpointSpec** – Properties that can be configured to access and load balance a service.
- **Mode** – The mode of resolution to use for internal load balancing
between tasks (`vip` or `dnsrr`). Defaults to `vip` if not provided.
- **Ports** – List of exposed ports that this service is accessible on from
the outside, in the form of:
`{"Protocol": <"tcp"|"udp">, "PublishedPort": <port>, "TargetPort": <port>}`.
Ports can only be provided if `vip` resolution mode is used.
**Query parameters**:
- **version** – The version number of the service object being updated. This is
required to avoid conflicting writes.
**Request Headers**:
- **Content-type** – Set to `"application/json"`.
- **X-Registry-Auth** – base64-encoded AuthConfig object, containing either
login information, or a token. Refer to the [create an image](#create-an-image)
section for more details.
**Status codes**:
- **200** – no error
- **404** – no such service
- **406** - node is not part of a swarm
- **500** – server error
### 3.10 Tasks
**Note**: Task operations require the engine to be part of a swarm.
#### List tasks
`GET /tasks`
List tasks
**Example request**:
GET /v1.24/tasks HTTP/1.1
**Example response**:
[
{
"ID": "0kzzo1i0y4jz6027t0k7aezc7",
"Version": {
"Index": 71
},
"CreatedAt": "2016-06-07T21:07:31.171892745Z",
"UpdatedAt": "2016-06-07T21:07:31.376370513Z",
"Spec": {
"ContainerSpec": {
"Image": "redis"
},
"Resources": {
"Limits": {},
"Reservations": {}
},
"RestartPolicy": {
"Condition": "any",
"MaxAttempts": 0
},
"Placement": {}
},
"ServiceID": "9mnpnzenvg8p8tdbtq4wvbkcz",
"Slot": 1,
"NodeID": "60gvrl6tm78dmak4yl7srz94v",
"Status": {
"Timestamp": "2016-06-07T21:07:31.290032978Z",
"State": "running",
"Message": "started",
"ContainerStatus": {
"ContainerID": "e5d62702a1b48d01c3e02ca1e0212a250801fa8d67caca0b6f35919ebc12f035",
"PID": 677
}
},
"DesiredState": "running",
"NetworksAttachments": [
{
"Network": {
"ID": "4qvuz4ko70xaltuqbt8956gd1",
"Version": {
"Index": 18
},
"CreatedAt": "2016-06-07T20:31:11.912919752Z",
"UpdatedAt": "2016-06-07T21:07:29.955277358Z",
"Spec": {
"Name": "ingress",
"Labels": {
"com.docker.swarm.internal": "true"
},
"DriverConfiguration": {},
"IPAMOptions": {
"Driver": {},
"Configs": [
{
"Subnet": "10.255.0.0/16",
"Gateway": "10.255.0.1"
}
]
}
},
"DriverState": {
"Name": "overlay",
"Options": {
"com.docker.network.driver.overlay.vxlanid_list": "256"
}
},
"IPAMOptions": {
"Driver": {
"Name": "default"
},
"Configs": [
{
"Subnet": "10.255.0.0/16",
"Gateway": "10.255.0.1"
}
]
}
},
"Addresses": [
"10.255.0.10/16"
]
}
],
},
{
"ID": "1yljwbmlr8er2waf8orvqpwms",
"Version": {
"Index": 30
},
"CreatedAt": "2016-06-07T21:07:30.019104782Z",
"UpdatedAt": "2016-06-07T21:07:30.231958098Z",
"Name": "hopeful_cori",
"Spec": {
"ContainerSpec": {
"Image": "redis"
},
"Resources": {
"Limits": {},
"Reservations": {}
},
"RestartPolicy": {
"Condition": "any",
"MaxAttempts": 0
},
"Placement": {}
},
"ServiceID": "9mnpnzenvg8p8tdbtq4wvbkcz",
"Slot": 1,
"NodeID": "60gvrl6tm78dmak4yl7srz94v",
"Status": {
"Timestamp": "2016-06-07T21:07:30.202183143Z",
"State": "shutdown",
"Message": "shutdown",
"ContainerStatus": {
"ContainerID": "1cf8d63d18e79668b0004a4be4c6ee58cddfad2dae29506d8781581d0688a213"
}
},
"DesiredState": "shutdown",
"NetworksAttachments": [
{
"Network": {
"ID": "4qvuz4ko70xaltuqbt8956gd1",
"Version": {
"Index": 18
},
"CreatedAt": "2016-06-07T20:31:11.912919752Z",
"UpdatedAt": "2016-06-07T21:07:29.955277358Z",
"Spec": {
"Name": "ingress",
"Labels": {
"com.docker.swarm.internal": "true"
},
"DriverConfiguration": {},
"IPAMOptions": {
"Driver": {},
"Configs": [
{
"Subnet": "10.255.0.0/16",
"Gateway": "10.255.0.1"
}
]
}
},
"DriverState": {
"Name": "overlay",
"Options": {
"com.docker.network.driver.overlay.vxlanid_list": "256"
}
},
"IPAMOptions": {
"Driver": {
"Name": "default"
},
"Configs": [
{
"Subnet": "10.255.0.0/16",
"Gateway": "10.255.0.1"
}
]
}
},
"Addresses": [
"10.255.0.5/16"
]
}
]
}
]
**Query parameters**:
- **filters** – a JSON encoded value of the filters (a `map[string][]string`) to process on the
services list. Available filters:
- `id=<task id>`
- `name=<task name>`
- `service=<service name>`
- `node=<node id or name>`
- `label=key` or `label="key=value"`
- `desired-state=(running | shutdown | accepted)`
**Status codes**:
- **200** – no error
- **406** - node is not part of a swarm
- **500** – server error
#### Inspect a task
`GET /tasks/(id)`
Get details on the task `id`
**Example request**:
GET /v1.24/tasks/0kzzo1i0y4jz6027t0k7aezc7 HTTP/1.1
**Example response**:
{
"ID": "0kzzo1i0y4jz6027t0k7aezc7",
"Version": {
"Index": 71
},
"CreatedAt": "2016-06-07T21:07:31.171892745Z",
"UpdatedAt": "2016-06-07T21:07:31.376370513Z",
"Spec": {
"ContainerSpec": {
"Image": "redis"
},
"Resources": {
"Limits": {},
"Reservations": {}
},
"RestartPolicy": {
"Condition": "any",
"MaxAttempts": 0
},
"Placement": {}
},
"ServiceID": "9mnpnzenvg8p8tdbtq4wvbkcz",
"Slot": 1,
"NodeID": "60gvrl6tm78dmak4yl7srz94v",
"Status": {
"Timestamp": "2016-06-07T21:07:31.290032978Z",
"State": "running",
"Message": "started",
"ContainerStatus": {
"ContainerID": "e5d62702a1b48d01c3e02ca1e0212a250801fa8d67caca0b6f35919ebc12f035",
"PID": 677
}
},
"DesiredState": "running",
"NetworksAttachments": [
{
"Network": {
"ID": "4qvuz4ko70xaltuqbt8956gd1",
"Version": {
"Index": 18
},
"CreatedAt": "2016-06-07T20:31:11.912919752Z",
"UpdatedAt": "2016-06-07T21:07:29.955277358Z",
"Spec": {
"Name": "ingress",
"Labels": {
"com.docker.swarm.internal": "true"
},
"DriverConfiguration": {},
"IPAMOptions": {
"Driver": {},
"Configs": [
{
"Subnet": "10.255.0.0/16",
"Gateway": "10.255.0.1"
}
]
}
},
"DriverState": {
"Name": "overlay",
"Options": {
"com.docker.network.driver.overlay.vxlanid_list": "256"
}
},
"IPAMOptions": {
"Driver": {
"Name": "default"
},
"Configs": [
{
"Subnet": "10.255.0.0/16",
"Gateway": "10.255.0.1"
}
]
}
},
"Addresses": [
"10.255.0.10/16"
]
}
]
}
**Status codes**:
- **200** – no error
- **404** – unknown task
- **406** - node is not part of a swarm
- **500** – server error
## 4. Going further
### 4.1 Inside `docker run`
As an example, the `docker run` command line makes the following API calls:
- Create the container
- If the status code is 404, it means the image doesn't exist:
- Try to pull it.
- Then, retry to create the container.
- Start the container.
- If you are not in detached mode:
- Attach to the container, using `logs=1` (to have `stdout` and
`stderr` from the container's start) and `stream=1`
- If in detached mode or only `stdin` is attached, display the container's id.
### 4.2 Hijacking
In this version of the API, `/attach`, uses hijacking to transport `stdin`,
`stdout`, and `stderr` on the same socket.
To hint potential proxies about connection hijacking, Docker client sends
connection upgrade headers similarly to websocket.
Upgrade: tcp
Connection: Upgrade
When Docker daemon detects the `Upgrade` header, it switches its status code
from **200 OK** to **101 UPGRADED** and resends the same headers.
### 4.3 CORS Requests
To set cross origin requests to the Engine API please give values to
`--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
default or blank means CORS disabled
$ dockerd -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"
|