github.com/pritambaral/docker@v1.4.2-0.20150120174542-b2fe1b3dd952/docs/sources/reference/api/docker_remote_api_v1.2.md (about)

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