github.com/0xfoo/docker@v1.8.2/docs/reference/api/docker_remote_api_v1.0.md (about)

     1  <!--[metadata]>
     2  +++
     3  draft = true
     4  title = "Remote API v1.0"
     5  description = "API Documentation for Docker"
     6  keywords = ["API, Docker, rcli, REST,  documentation"]
     7  [menu.main]
     8  parent = "smn_remoteapi"
     9  +++
    10  <![end-metadata]-->
    11  
    12  # Docker Remote API v1.0
    13  
    14  # 1. Brief introduction
    15  
    16  -   The Remote API is replacing rcli
    17  -   Default port in the docker daemon is 2375
    18  -   The API tends to be REST, but for some complex commands, like attach
    19      or pull, the HTTP connection is hijacked to transport stdout stdin
    20      and stderr
    21  
    22  # 2. Endpoints
    23  
    24  ## 2.1 Containers
    25  
    26  ### List containers
    27  
    28  `GET /containers/json`
    29  
    30  List containers
    31  
    32  **Example request**:
    33  
    34          GET /containers/json?all=1&before=8dfafdbc3a40 HTTP/1.1
    35  
    36  **Example response**:
    37  
    38          HTTP/1.1 200 OK
    39          Content-Type: application/json
    40  
    41          [
    42               {
    43                       "Id": "8dfafdbc3a40",
    44                       "Image": "ubuntu:latest",
    45                       "Command": "echo 1",
    46                       "Created": 1367854155,
    47                       "Status": "Exit 0"
    48               },
    49               {
    50                       "Id": "9cd87474be90",
    51                       "Image": "ubuntu:latest",
    52                       "Command": "echo 222222",
    53                       "Created": 1367854155,
    54                       "Status": "Exit 0"
    55               },
    56               {
    57                       "Id": "3176a2479c92",
    58                       "Image": "centos:latest",
    59                       "Command": "echo 3333333333333333",
    60                       "Created": 1367854154,
    61                       "Status": "Exit 0"
    62               },
    63               {
    64                       "Id": "4cb07b47f9fb",
    65                       "Image": "fedora:latest",
    66                       "Command": "echo 444444444444444444444444444444444",
    67                       "Created": 1367854152,
    68                       "Status": "Exit 0"
    69               }
    70          ]
    71  
    72  Query Parameters:
    73  
    74  -   **all** – 1/True/true or 0/False/false, Show all containers.
    75          Only running containers are shown by default
    76  -   **limit** – Show `limit` last created
    77          containers, include non-running ones.
    78  -   **since** – Show only containers created since Id, include
    79          non-running ones.
    80  -   **before** – Show only containers created before Id, include
    81          non-running ones.
    82  
    83  Status Codes:
    84  
    85  -   **200** – no error
    86  -   **400** – bad parameter
    87  -   **500** – server error
    88  
    89  ### Create a container
    90  
    91  `POST /containers/create`
    92  
    93  Create a container
    94  
    95  **Example request**:
    96  
    97          POST /containers/create HTTP/1.1
    98          Content-Type: application/json
    99  
   100          {
   101               "Hostname":"",
   102               "User":"",
   103               "Memory":0,
   104               "MemorySwap":0,
   105               "AttachStdin":false,
   106               "AttachStdout":true,
   107               "AttachStderr":true,
   108               "PortSpecs":null,
   109               "Tty":false,
   110               "OpenStdin":false,
   111               "StdinOnce":false,
   112               "Env":null,
   113               "Cmd":[
   114                       "date"
   115               ],
   116               "Dns":null,
   117               "Image":"ubuntu",
   118               "Volumes":{},
   119               "VolumesFrom":""
   120          }
   121  
   122  **Example response**:
   123  
   124          HTTP/1.1 201 Created
   125          Content-Type: application/json
   126  
   127          {
   128               "Id":"e90e34656806"
   129               "Warnings":[]
   130          }
   131  
   132  Json Parameters:
   133  
   134  -   **config** – the container's configuration
   135  
   136  Status Codes:
   137  
   138  -   **201** – no error
   139  -   **404** – no such container
   140  -   **406** – impossible to attach (container not running)
   141  -   **500** – server error
   142  
   143  ### Inspect a container
   144  
   145  `GET /containers/(id)/json`
   146  
   147  Return low-level information on the container `id`
   148  
   149  
   150  **Example request**:
   151  
   152          GET /containers/4fa6e0f0c678/json HTTP/1.1
   153  
   154  **Example response**:
   155  
   156          HTTP/1.1 200 OK
   157          Content-Type: application/json
   158  
   159          {
   160                       "Id": "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2",
   161                       "Created": "2013-05-07T14:51:42.041847+02:00",
   162                       "Path": "date",
   163                       "Args": [],
   164                       "Config": {
   165                               "Hostname": "4fa6e0f0c678",
   166                               "User": "",
   167                               "Memory": 0,
   168                               "MemorySwap": 0,
   169                               "AttachStdin": false,
   170                               "AttachStdout": true,
   171                               "AttachStderr": true,
   172                               "PortSpecs": null,
   173                               "Tty": false,
   174                               "OpenStdin": false,
   175                               "StdinOnce": false,
   176                               "Env": null,
   177                               "Cmd": [
   178                                       "date"
   179                               ],
   180                               "Dns": null,
   181                               "Image": "ubuntu",
   182                               "Volumes": {},
   183                               "VolumesFrom": ""
   184                       },
   185                       "State": {
   186                               "Running": false,
   187                               "Pid": 0,
   188                               "ExitCode": 0,
   189                               "StartedAt": "2013-05-07T14:51:42.087658+02:01360",
   190                               "Ghost": false
   191                       },
   192                       "Image": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
   193                       "NetworkSettings": {
   194                               "IpAddress": "",
   195                               "IpPrefixLen": 0,
   196                               "Gateway": "",
   197                               "Bridge": "",
   198                               "PortMapping": null
   199                       },
   200                       "SysInitPath": "/home/kitty/go/src/github.com/docker/docker/bin/docker",
   201                       "ResolvConfPath": "/etc/resolv.conf",
   202                       "Volumes": {}
   203          }
   204  
   205  Status Codes:
   206  
   207  -   **200** – no error
   208  -   **404** – no such container
   209  -   **500** – server error
   210  
   211  ### Inspect changes on a container's filesystem
   212  
   213  `GET /containers/(id)/changes`
   214  
   215  Inspect changes on container `id`'s filesystem
   216  
   217  **Example request**:
   218  
   219          GET /containers/4fa6e0f0c678/changes HTTP/1.1
   220  
   221  **Example response**:
   222  
   223          HTTP/1.1 200 OK
   224          Content-Type: application/json
   225  
   226          [
   227               {
   228                       "Path": "/dev",
   229                       "Kind": 0
   230               },
   231               {
   232                       "Path": "/dev/kmsg",
   233                       "Kind": 1
   234               },
   235               {
   236                       "Path": "/test",
   237                       "Kind": 1
   238               }
   239          ]
   240  
   241  Status Codes:
   242  
   243  -   **200** – no error
   244  -   **404** – no such container
   245  -   **500** – server error
   246  
   247  ### Export a container
   248  
   249  `GET /containers/(id)/export`
   250  
   251  Export the contents of container `id`
   252  
   253  **Example request**:
   254  
   255          GET /containers/4fa6e0f0c678/export HTTP/1.1
   256  
   257  **Example response**:
   258  
   259          HTTP/1.1 200 OK
   260          Content-Type: application/octet-stream
   261  
   262          {{ TAR STREAM }}
   263  
   264  Status Codes:
   265  
   266  -   **200** – no error
   267  -   **404** – no such container
   268  -   **500** – server error
   269  
   270  ### Start a container
   271  
   272  `POST /containers/(id)/start`
   273  
   274  Start the container `id`
   275  
   276  **Example request**:
   277  
   278          POST /containers/e90e34656806/start HTTP/1.1
   279  
   280  **Example response**:
   281  
   282          HTTP/1.1 200 OK
   283  
   284  Status Codes:
   285  
   286  -   **200** – no error
   287  -   **404** – no such container
   288  -   **500** – server error
   289  
   290  ### Stop a container
   291  
   292  `POST /containers/(id)/stop`
   293  
   294  Stop the container `id`
   295  
   296  **Example request**:
   297  
   298          POST /containers/e90e34656806/stop?t=5 HTTP/1.1
   299  
   300  **Example response**:
   301  
   302          HTTP/1.1 204 OK
   303  
   304  Query Parameters:
   305  
   306  -   **t** – number of seconds to wait before killing the container
   307  
   308  Status Codes:
   309  
   310  -   **204** – no error
   311  -   **404** – no such container
   312  -   **500** – server error
   313  
   314  ### Restart a container
   315  
   316  `POST /containers/(id)/restart`
   317  
   318  Restart the container `id`
   319  
   320  **Example request**:
   321  
   322          POST /containers/e90e34656806/restart?t=5 HTTP/1.1
   323  
   324  **Example response**:
   325  
   326          HTTP/1.1 204 No Content
   327  
   328  Query Parameters:
   329  
   330  -   **t** – number of seconds to wait before killing the container
   331  
   332  Status Codes:
   333  
   334  -   **204** – no error
   335  -   **404** – no such container
   336  -   **500** – server error
   337  
   338  ### Kill a container
   339  
   340  `POST /containers/(id)/kill`
   341  
   342  Kill the container `id`
   343  
   344  **Example request**:
   345  
   346          POST /containers/e90e34656806/kill HTTP/1.1
   347  
   348  **Example response**:
   349  
   350          HTTP/1.1 204 No Content
   351  
   352  Status Codes:
   353  
   354  -   **204** – no error
   355  -   **404** – no such container
   356  -   **500** – server error
   357  
   358  ### Attach to a container
   359  
   360  `POST /containers/(id)/attach`
   361  
   362  Attach to the container `id`
   363  
   364  **Example request**:
   365  
   366          POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
   367  
   368  **Example response**:
   369  
   370          HTTP/1.1 200 OK
   371          Content-Type: application/vnd.docker.raw-stream
   372  
   373          {{ STREAM }}
   374  
   375  Query Parameters:
   376  
   377  -   **logs** – 1/True/true or 0/False/false, return logs. Defaul
   378          false
   379  -   **stream** – 1/True/true or 0/False/false, return stream.
   380          Default false
   381  -   **stdin** – 1/True/true or 0/False/false, if stream=true, attach
   382          to stdin. Default false
   383  -   **stdout** – 1/True/true or 0/False/false, if logs=true, return
   384          stdout log, if stream=true, attach to stdout. Default false
   385  -   **stderr** – 1/True/true or 0/False/false, if logs=true, return
   386          stderr log, if stream=true, attach to stderr. Default false
   387  
   388  Status Codes:
   389  
   390  -   **200** – no error
   391  -   **400** – bad parameter
   392  -   **404** – no such container
   393  -   **500** – server error
   394  
   395  ### Attach to a container (websocket)
   396  
   397  `GET /containers/(id)/attach/ws`
   398  
   399  Attach to the container `id` via websocket
   400  
   401  Implements websocket protocol handshake according to [RFC 6455](http://tools.ietf.org/html/rfc6455)
   402  
   403  **Example request**
   404  
   405          GET /containers/e90e34656806/attach/ws?logs=0&stream=1&stdin=1&stdout=1&stderr=1 HTTP/1.1
   406  
   407  **Example response**
   408  
   409          {{ STREAM }}
   410  
   411  Query Parameters:
   412  
   413  -   **logs** – 1/True/true or 0/False/false, return logs. Default false
   414  -   **stream** – 1/True/true or 0/False/false, return stream.
   415          Default false
   416  -   **stdin** – 1/True/true or 0/False/false, if stream=true, attach
   417          to stdin. Default false
   418  -   **stdout** – 1/True/true or 0/False/false, if logs=true, return
   419          stdout log, if stream=true, attach to stdout. Default false
   420  -   **stderr** – 1/True/true or 0/False/false, if logs=true, return
   421          stderr log, if stream=true, attach to stderr. Default false
   422  
   423  Status Codes:
   424  
   425  -   **200** – no error
   426  -   **400** – bad parameter
   427  -   **404** – no such container
   428  -   **500** – server error
   429  
   430  ### Wait a container
   431  
   432  `POST /containers/(id)/wait`
   433  
   434  Block until container `id` stops, then returns the exit code
   435  
   436  **Example request**:
   437  
   438          POST /containers/16253994b7c4/wait HTTP/1.1
   439  
   440  **Example response**:
   441  
   442          HTTP/1.1 200 OK
   443          Content-Type: application/json
   444  
   445          {"StatusCode": 0}
   446  
   447  Status Codes:
   448  
   449  -   **200** – no error
   450  -   **404** – no such container
   451  -   **500** – server error
   452  
   453  ### Remove a container
   454  
   455  `DELETE /containers/(id)`
   456  
   457  Remove the container `id` from the filesystem
   458  
   459  **Example request**:
   460  
   461          DELETE /containers/16253994b7c4?v=1 HTTP/1.1
   462  
   463  **Example response**:
   464  
   465          HTTP/1.1 204 OK
   466  
   467  Query Parameters:
   468  
   469  -   **v** – 1/True/true or 0/False/false, Remove the volumes
   470          associated to the container. Default false
   471  
   472  Status Codes:
   473  
   474  -   **204** – no error
   475  -   **400** – bad parameter
   476  -   **404** – no such container
   477  -   **500** – server error
   478  
   479  ## 2.2 Images
   480  
   481  ### List Images
   482  
   483  `GET /images/(format)`
   484  
   485  List images `format` could be json or viz (json default)
   486  
   487  **Example request**:
   488  
   489          GET /images/json?all=0 HTTP/1.1
   490  
   491  **Example response**:
   492  
   493          HTTP/1.1 200 OK
   494          Content-Type: application/json
   495  
   496          [
   497               {
   498                       "Repository":"ubuntu",
   499                       "Tag":"precise",
   500                       "Id":"b750fe79269d",
   501                       "Created":1364102658
   502               },
   503               {
   504                       "Repository":"ubuntu",
   505                       "Tag":"12.04",
   506                       "Id":"b750fe79269d",
   507                       "Created":1364102658
   508               }
   509          ]
   510  
   511  **Example request**:
   512  
   513          GET /images/viz HTTP/1.1
   514  
   515  **Example response**:
   516  
   517          HTTP/1.1 200 OK
   518          Content-Type: text/plain
   519  
   520          digraph docker {
   521          "d82cbacda43a" -> "074be284591f"
   522          "1496068ca813" -> "08306dc45919"
   523          "08306dc45919" -> "0e7893146ac2"
   524          "b750fe79269d" -> "1496068ca813"
   525          base -> "27cf78414709" [style=invis]
   526          "f71189fff3de" -> "9a33b36209ed"
   527          "27cf78414709" -> "b750fe79269d"
   528          "0e7893146ac2" -> "d6434d954665"
   529          "d6434d954665" -> "d82cbacda43a"
   530          base -> "e9aa60c60128" [style=invis]
   531          "074be284591f" -> "f71189fff3de"
   532          "b750fe79269d" [label="b750fe79269d\nubuntu",shape=box,fillcolor="paleturquoise",style="filled,rounded"];
   533          "e9aa60c60128" [label="e9aa60c60128\ncentos",shape=box,fillcolor="paleturquoise",style="filled,rounded"];
   534          "9a33b36209ed" [label="9a33b36209ed\nfedora",shape=box,fillcolor="paleturquoise",style="filled,rounded"];
   535          base [style=invisible]
   536          }
   537  
   538  Query Parameters:
   539  
   540  -   **all** – 1/True/true or 0/False/false, Show all containers.
   541          Only running containers are shown by defaul
   542  
   543  Status Codes:
   544  
   545  -   **200** – no error
   546  -   **400** – bad parameter
   547  -   **500** – server error
   548  
   549  ### Create an image
   550  
   551  `POST /images/create`
   552  
   553  Create an image, either by pull it from the registry or by importing i
   554  
   555  **Example request**:
   556  
   557          POST /images/create?fromImage=ubuntu HTTP/1.1
   558  
   559  **Example response**:
   560  
   561          HTTP/1.1 200 OK
   562          Content-Type: application/vnd.docker.raw-stream
   563  
   564          {{ STREAM }}
   565  
   566  Query Parameters:
   567  
   568  -   **fromImage** – name of the image to pull
   569  -   **fromSrc** – source to import, - means stdin
   570  -   **repo** – repository
   571  -   **tag** – tag
   572  -   **registry** – the registry to pull from
   573  
   574  Status Codes:
   575  
   576  -   **200** – no error
   577  -   **500** – server error
   578  
   579  ### Insert a file in an image
   580  
   581  `POST /images/(name)/insert`
   582  
   583  Insert a file from `url` in the image `name` at `path`
   584  
   585  **Example request**:
   586  
   587          POST /images/test/insert?path=/usr&url=myurl HTTP/1.1
   588  
   589  **Example response**:
   590  
   591          HTTP/1.1 200 OK
   592  
   593          {{ TAR STREAM }}
   594  
   595  Query Parameters:
   596  
   597  -	**url** – The url from where the file is taken
   598  -	**path** – The path where the file is stored
   599  
   600  Status Codes:
   601  
   602  -   **200** – no error
   603  -   **500** – server error
   604  
   605  ### Inspect an image
   606  
   607  `GET /images/(name)/json`
   608  
   609  Return low-level information on the image `name`
   610  
   611  **Example request**:
   612  
   613          GET /images/centos/json HTTP/1.1
   614  
   615  **Example response**:
   616  
   617          HTTP/1.1 200 OK
   618          Content-Type: application/json
   619  
   620          {
   621               "id":"b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
   622               "parent":"27cf784147099545",
   623               "created":"2013-03-23T22:24:18.818426-07:00",
   624               "container":"3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
   625               "container_config":
   626                       {
   627                               "Hostname":"",
   628                               "User":"",
   629                               "Memory":0,
   630                               "MemorySwap":0,
   631                               "AttachStdin":false,
   632                               "AttachStdout":false,
   633                               "AttachStderr":false,
   634                               "PortSpecs":null,
   635                               "Tty":true,
   636                               "OpenStdin":true,
   637                               "StdinOnce":false,
   638                               "Env":null,
   639                               "Cmd": ["/bin/bash"],
   640                               "Dns":null,
   641                               "Image":"centos",
   642                               "Volumes":null,
   643                               "VolumesFrom":""
   644                       }
   645          }
   646  
   647  Status Codes:
   648  
   649  -   **200** – no error
   650  -   **404** – no such image
   651  -   **500** – server error
   652  
   653  ### Get the history of an image
   654  
   655  `GET /images/(name)/history`
   656  
   657  Return the history of the image `name`
   658  
   659  **Example request**:
   660  
   661          GET /images/fedora/history HTTP/1.1
   662  
   663  **Example response**:
   664  
   665          HTTP/1.1 200 OK
   666          Content-Type: application/json
   667  
   668          [
   669               {
   670                       "Id": "b750fe79269d",
   671                       "Created": 1364102658,
   672                       "CreatedBy": "/bin/bash"
   673               },
   674               {
   675                       "Id": "27cf78414709",
   676                       "Created": 1364068391,
   677                       "CreatedBy": ""
   678               }
   679          ]
   680  
   681  Status Codes:
   682  
   683  -   **200** – no error
   684  -   **404** – no such image
   685  -   **500** – server error
   686  
   687  ### Push an image on the registry
   688  
   689  `POST /images/(name)/push`
   690  
   691  Push the image `name` on the registry
   692  
   693      > **Example request**:
   694      >
   695      >     POST /images/test/push HTTP/1.1
   696      >
   697      > **Example response**:
   698  
   699          HTTP/1.1 200 OK
   700          Content-Type: application/vnd.docker.raw-stream
   701  
   702          {{ STREAM }}
   703  
   704  Status Codes:
   705  
   706  -   **200** – no error
   707  -   **404** – no such image
   708  -   **500** – server error
   709  
   710  ### Tag an image into a repository
   711  
   712  `POST /images/(name)/tag`
   713  
   714  Tag the image `name` into a repository
   715  
   716  **Example request**:
   717  
   718          POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
   719  
   720  **Example response**:
   721  
   722          HTTP/1.1 201 OK
   723  
   724  Query Parameters:
   725  
   726  -   **repo** – The repository to tag in
   727  -   **force** – 1/True/true or 0/False/false, default false
   728  -   **tag** - The new tag name
   729  
   730  Status Codes:
   731  
   732  -   **201** – no error
   733  -   **400** – bad parameter
   734  -   **404** – no such image
   735  -   **500** – server error
   736  
   737  ### Remove an image
   738  
   739  `DELETE /images/(name)`
   740  
   741  Remove the image `name` from the filesystem
   742  
   743  **Example request**:
   744  
   745          DELETE /images/test HTTP/1.1
   746  
   747  **Example response**:
   748  
   749          HTTP/1.1 204 No Content
   750  
   751  Status Codes:
   752  
   753  -   **204** – no error
   754  -   **404** – no such image
   755  -   **500** – server error
   756  
   757  ### Search images
   758  
   759  `GET /images/search`
   760  
   761  Search for an image on [Docker Hub](https://hub.docker.com)
   762  
   763  **Example request**:
   764  
   765          GET /images/search?term=sshd HTTP/1.1
   766  
   767  **Example response**:
   768  
   769          HTTP/1.1 200 OK
   770          Content-Type: application/json
   771  
   772          [
   773               {
   774                       "Name":"cespare/sshd",
   775                       "Description":""
   776               },
   777               {
   778                       "Name":"johnfuller/sshd",
   779                       "Description":""
   780               },
   781               {
   782                       "Name":"dhrp/mongodb-sshd",
   783                       "Description":""
   784               }
   785          ]
   786  
   787          :query term: term to search
   788          :statuscode 200: no error
   789          :statuscode 500: server error
   790  
   791  ## 2.3 Misc
   792  
   793  ### Build an image from Dockerfile via stdin
   794  
   795  `POST /build`
   796  
   797  Build an image from Dockerfile via stdin
   798  
   799  **Example request**:
   800  
   801          POST /build HTTP/1.1
   802  
   803          {{ TAR STREAM }}
   804  
   805  **Example response**:
   806  
   807          HTTP/1.1 200 OK
   808  
   809          {{ STREAM }}
   810  
   811  Query Parameters:
   812  
   813  -   **t** – repository name to be applied to the resulting image in
   814          case of success
   815  
   816  Status Codes:
   817  
   818  -   **200** – no error
   819  -   **500** – server error
   820  
   821  ### Get default username and email
   822  
   823  `GET /auth`
   824  
   825  Get the default username and email
   826  
   827  **Example request**:
   828  
   829          GET /auth HTTP/1.1
   830  
   831  **Example response**:
   832  
   833          HTTP/1.1 200 OK
   834          Content-Type: application/json
   835  
   836          {
   837               "username":"hannibal",
   838               "email":"hannibal@a-team.com"
   839          }
   840  
   841  Status Codes:
   842  
   843  -   **200** – no error
   844  -   **500** – server error
   845  
   846  ### Check auth configuration and store i
   847  
   848  `POST /auth`
   849  
   850  Get the default username and email
   851  
   852  **Example request**:
   853  
   854          POST /auth HTTP/1.1
   855          Content-Type: application/json
   856  
   857          {
   858               "username":"hannibal",
   859               "password:"xxxx",
   860               "email":"hannibal@a-team.com"
   861          }
   862  
   863  **Example response**:
   864  
   865          HTTP/1.1 200 OK
   866          Content-Type: text/plain
   867  
   868  Status Codes:
   869  
   870  -   **200** – no error
   871  -   **204** – no error
   872  -   **500** – server error
   873  
   874  ### Display system-wide information
   875  
   876  `GET /info`
   877  
   878  Display system-wide information
   879  
   880  **Example request**:
   881  
   882          GET /info HTTP/1.1
   883  
   884  **Example response**:
   885  
   886          HTTP/1.1 200 OK
   887          Content-Type: application/json
   888  
   889          {
   890               "Containers":11,
   891               "Images":16,
   892               "Debug":false,
   893               "NFd": 11,
   894               "NGoroutines":21,
   895               "MemoryLimit":true,
   896               "SwapLimit":false
   897          }
   898  
   899  Status Codes:
   900  
   901  -   **200** – no error
   902  -   **500** – server error
   903  
   904  ### Show the docker version information
   905  
   906  `GET /version`
   907  
   908  Show the docker version information
   909  
   910  **Example request**:
   911  
   912          GET /version HTTP/1.1
   913  
   914  **Example response**:
   915  
   916          HTTP/1.1 200 OK
   917          Content-Type: application/json
   918  
   919          {
   920               "Version":"0.2.2",
   921               "GitCommit":"5a2a5cc+CHANGES",
   922               "GoVersion":"go1.0.3"
   923          }
   924  
   925  Status Codes:
   926  
   927  -   **200** – no error
   928  -   **500** – server error
   929  
   930  ### Create a new image from a container's changes
   931  
   932  `POST /commit`
   933  
   934  Create a new image from a container's changes
   935      >
   936      > **Example request**:
   937  
   938          POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
   939          Content-Type: application/json
   940  
   941          {
   942              "Cmd": ["cat", "/world"],
   943              "PortSpecs":["22"]
   944          }
   945  
   946  **Example response**:
   947  
   948          HTTP/1.1 201 OK
   949          Content-Type: application/vnd.docker.raw-stream
   950  
   951          {"Id": "596069db4bf5"}
   952  
   953  Query Parameters:
   954  
   955  -   **container** – source container
   956  -   **repo** – repository
   957  -   **tag** – tag
   958  -   **m** – commit message
   959  -   **author** – author (e.g., "John Hannibal Smith
   960          <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
   961  
   962  Status Codes:
   963  
   964  -   **201** – no error
   965  -   **404** – no such container
   966  -   **500** – server error
   967  
   968  # 3. Going further
   969  
   970  ## 3.1 Inside `docker run`
   971  
   972  As an example, the `docker run` command line makes the following API calls:
   973  
   974  - Create the container
   975  
   976  - If the status code is 404, it means the image doesn't exist:
   977      - Try to pull it
   978      - Then retry to create the container
   979  
   980  - Start the container
   981  
   982  - If you are not in detached mode:
   983      - Attach to the container, using logs=1 (to have stdout and
   984            stderr from the container's start) and stream=1
   985  
   986  - If in detached mode or only stdin is attached:
   987      - Display the container's
   988  
   989  ## 3.2 Hijacking
   990  
   991  In this first version of the API, some of the endpoints, like /attach,
   992  /pull or /push uses hijacking to transport stdin, stdout and stderr on
   993  the same socket. This might change in the future.