From 792403f2dc38cf880ae79d44093914f9b54eb031 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Thu, 26 Sep 2013 00:16:15 -0700 Subject: [PATCH 1/4] Add the X-Docker-Registry header and /v1/_ping endpoint --- docs/sources/api/registry_api.rst | 48 +++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/docs/sources/api/registry_api.rst b/docs/sources/api/registry_api.rst index 58c8ff3bd4..3cedbc0e13 100644 --- a/docs/sources/api/registry_api.rst +++ b/docs/sources/api/registry_api.rst @@ -72,6 +72,7 @@ Layer HTTP/1.1 200 Vary: Accept Content-Type: application/json + X-Docker-Registry-Version: 0.6.0 Cookie: (Cookie provided by the Registry) { @@ -165,6 +166,7 @@ Layer HTTP/1.1 200 Vary: Accept Content-Type: application/json + X-Docker-Registry-Version: 0.6.0 "" @@ -205,6 +207,7 @@ Image HTTP/1.1 200 Vary: Accept Content-Type: application/json + X-Docker-Registry-Version: 0.6.0 "" @@ -234,6 +237,7 @@ Image HTTP/1.1 200 Vary: Accept Content-Type: application/json + X-Docker-Registry-Version: 0.6.0 { “id”: “088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c”, @@ -271,6 +275,7 @@ Ancestry HTTP/1.1 200 Vary: Accept Content-Type: application/json + X-Docker-Registry-Version: 0.6.0 ["088b4502f51920fbd9b7c503e87c7a2c05aa3adc3d35e79c031fa126b403200f", "aeee63968d87c7da4a5cf5d2be6bee4e21bc226fd62273d180a49c96c62e4543", @@ -297,6 +302,7 @@ Ancestry Host: registry-1.docker.io Accept: application/json Content-Type: application/json + X-Docker-Registry-Version: 0.6.0 Cookie: (Cookie provided by the Registry) :parameter namespace: namespace for the repo @@ -309,6 +315,7 @@ Ancestry HTTP/1.1 200 Vary: Accept Content-Type: application/json + X-Docker-Registry-Version: 0.6.0 { "latest": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f", @@ -332,6 +339,7 @@ Ancestry Host: registry-1.docker.io Accept: application/json Content-Type: application/json + X-Docker-Registry-Version: 0.6.0 Cookie: (Cookie provided by the Registry) :parameter namespace: namespace for the repo @@ -345,6 +353,7 @@ Ancestry HTTP/1.1 200 Vary: Accept Content-Type: application/json + X-Docker-Registry-Version: 0.6.0 "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f" @@ -377,6 +386,7 @@ Ancestry HTTP/1.1 200 Vary: Accept Content-Type: application/json + X-Docker-Registry-Version: 0.6.0 "" @@ -412,6 +422,7 @@ Ancestry HTTP/1.1 200 Vary: Accept Content-Type: application/json + X-Docker-Registry-Version: 0.6.0 "" @@ -449,6 +460,7 @@ Ancestry HTTP/1.1 200 Vary: Accept Content-Type: application/json + X-Docker-Registry-Version: 0.6.0 "" @@ -456,6 +468,42 @@ Ancestry :statuscode 401: Requires authorization :statuscode 404: Repository not found +2.4 Status +---------- + +.. http:get /v1/_ping + + Check status of the registry. This endpoint is also used to determine if + the registry supports SSL. + + **Example Request**: + + .. sourcecode:: http + + GET /v1/_ping HTTP/1.1 + Host: registry-1.docker.io + Accept: application/json + Content-Type: application/json + + "" + + :parameter namespace: namespace for the repo + :parameter repository: name for the repo + + **Example Response**: + + .. sourcecode:: http + + HTTP/1.1 200 + Vary: Accept + Content-Type: application/json + X-Docker-Registry-Version: 0.6.0 + + "" + + :statuscode 200: OK + + 3.0 Authorization ================= This is where we describe the authorization process, including the tokens and cookies. From 34e28ccc880d8b7919d029c0028d51cfd2f5f01a Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Thu, 26 Sep 2013 01:15:36 -0700 Subject: [PATCH 2/4] Remove smart quotes. Add the X-Docker-Token header Also fix the /layer endpoint, which had incorrect information --- docs/sources/api/index_api.rst | 40 +++++---- docs/sources/api/registry_api.rst | 141 ++++++++++++++---------------- 2 files changed, 89 insertions(+), 92 deletions(-) diff --git a/docs/sources/api/index_api.rst b/docs/sources/api/index_api.rst index c4b961aff2..b992712fc3 100644 --- a/docs/sources/api/index_api.rst +++ b/docs/sources/api/index_api.rst @@ -42,7 +42,7 @@ User Repo Authorization: Basic akmklmasadalkm== X-Docker-Token: true - [{“id”: “9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f”}] + [{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f"}] :parameter namespace: the namespace for the repo :parameter repo_name: the name for the repo @@ -54,7 +54,8 @@ User Repo HTTP/1.1 200 Vary: Accept Content-Type: application/json - WWW-Authenticate: Token signature=123abc,repository=”foo/bar”,access=write + WWW-Authenticate: Token signature=123abc,repository="foo/bar",access=write + X-Docker-Token: signature=123abc,repository="foo/bar",access=write X-Docker-Endpoints: registry-1.docker.io [, registry-2.docker.io] "" @@ -92,7 +93,8 @@ User Repo HTTP/1.1 202 Vary: Accept Content-Type: application/json - WWW-Authenticate: Token signature=123abc,repository=”foo/bar”,access=delete + WWW-Authenticate: Token signature=123abc,repository="foo/bar",access=delete + X-Docker-Token: signature=123abc,repository="foo/bar",access=write X-Docker-Endpoints: registry-1.docker.io [, registry-2.docker.io] "" @@ -124,7 +126,7 @@ Library Repo Authorization: Basic akmklmasadalkm== X-Docker-Token: true - [{“id”: “9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f”}] + [{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f"}] :parameter repo_name: the library name for the repo @@ -135,7 +137,8 @@ Library Repo HTTP/1.1 200 Vary: Accept Content-Type: application/json - WWW-Authenticate: Token signature=123abc,repository=”library/foobar”,access=write + WWW-Authenticate: Token signature=123abc,repository="library/foobar",access=write + X-Docker-Token: signature=123abc,repository="foo/bar",access=write X-Docker-Endpoints: registry-1.docker.io [, registry-2.docker.io] "" @@ -174,7 +177,8 @@ Library Repo HTTP/1.1 202 Vary: Accept Content-Type: application/json - WWW-Authenticate: Token signature=123abc,repository=”library/foobar”,access=delete + WWW-Authenticate: Token signature=123abc,repository="library/foobar",access=delete + X-Docker-Token: signature=123abc,repository="foo/bar",access=write X-Docker-Endpoints: registry-1.docker.io [, registry-2.docker.io] "" @@ -205,8 +209,8 @@ User Repo Images Content-Type: application/json Authorization: Basic akmklmasadalkm== - [{“id”: “9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f”, - “checksum”: “b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087”}] + [{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f", + "checksum": "b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087"}] :parameter namespace: the namespace for the repo :parameter repo_name: the name for the repo @@ -250,10 +254,10 @@ User Repo Images Vary: Accept Content-Type: application/json - [{“id”: “9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f”, - “checksum”: “b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087”}, - {“id”: “ertwetewtwe38722009fe6857087b486531f9a779a0c1dfddgfgsdgdsgds”, - “checksum”: “34t23f23fc17e3ed29dae8f12c4f9e89cc6f0bsdfgfsdgdsgdsgerwgew”}] + [{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f", + "checksum": "b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087"}, + {"id": "ertwetewtwe38722009fe6857087b486531f9a779a0c1dfddgfgsdgdsgds", + "checksum": "34t23f23fc17e3ed29dae8f12c4f9e89cc6f0bsdfgfsdgdsgdsgerwgew"}] :statuscode 200: OK :statuscode 404: Not found @@ -275,8 +279,8 @@ Library Repo Images Content-Type: application/json Authorization: Basic akmklmasadalkm== - [{“id”: “9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f”, - “checksum”: “b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087”}] + [{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f", + "checksum": "b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087"}] :parameter repo_name: the library name for the repo @@ -318,10 +322,10 @@ Library Repo Images Vary: Accept Content-Type: application/json - [{“id”: “9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f”, - “checksum”: “b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087”}, - {“id”: “ertwetewtwe38722009fe6857087b486531f9a779a0c1dfddgfgsdgdsgds”, - “checksum”: “34t23f23fc17e3ed29dae8f12c4f9e89cc6f0bsdfgfsdgdsgdsgerwgew”}] + [{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f", + "checksum": "b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087"}, + {"id": "ertwetewtwe38722009fe6857087b486531f9a779a0c1dfddgfgsdgdsgds", + "checksum": "34t23f23fc17e3ed29dae8f12c4f9e89cc6f0bsdfgfsdgdsgdsgerwgew"}] :statuscode 200: OK :statuscode 404: Not found diff --git a/docs/sources/api/registry_api.rst b/docs/sources/api/registry_api.rst index 3cedbc0e13..94e1c3b3e0 100644 --- a/docs/sources/api/registry_api.rst +++ b/docs/sources/api/registry_api.rst @@ -61,7 +61,7 @@ Layer Host: registry-1.docker.io Accept: application/json Content-Type: application/json - Authorization: Token akmklmasadalkmsdfgsdgdge33 + Authorization: Token signature=3200f02,repository="namespace/user",access=write' :parameter image_id: the id for the layer you want to get @@ -71,40 +71,10 @@ Layer HTTP/1.1 200 Vary: Accept - Content-Type: application/json X-Docker-Registry-Version: 0.6.0 Cookie: (Cookie provided by the Registry) - { - id: "088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c", - parent: "aeee6396d62273d180a49c96c62e45438d87c7da4a5cf5d2be6bee4e21bc226f", - created: "2013-04-30T17:46:10.843673+03:00", - container: "8305672a76cc5e3d168f97221106ced35a76ec7ddbb03209b0f0d96bf74f6ef7", - container_config: { - Hostname: "host-test", - User: "", - Memory: 0, - MemorySwap: 0, - AttachStdin: false, - AttachStdout: false, - AttachStderr: false, - PortSpecs: null, - Tty: false, - OpenStdin: false, - StdinOnce: false, - Env: null, - Cmd: [ - "/bin/bash", - "-c", - "apt-get -q -yy -f install libevent-dev" - ], - Dns: null, - Image: "imagename/blah", - Volumes: { }, - VolumesFrom: "" - }, - docker_version: "0.1.7" - } + {layer binary data stream} :statuscode 200: OK :statuscode 401: Requires authorization @@ -121,40 +91,10 @@ Layer PUT /v1/images/088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c/layer HTTP/1.1 Host: registry-1.docker.io - Accept: application/json - Content-Type: application/json - Authorization: Token akmklmasadalkmsdfgsdgdge33 + Transfer-Encoding: chunked + Authorization: Token signature=3200f02,repository="namespace/user",access=write' - { - id: "088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c", - parent: "aeee6396d62273d180a49c96c62e45438d87c7da4a5cf5d2be6bee4e21bc226f", - created: "2013-04-30T17:46:10.843673+03:00", - container: "8305672a76cc5e3d168f97221106ced35a76ec7ddbb03209b0f0d96bf74f6ef7", - container_config: { - Hostname: "host-test", - User: "", - Memory: 0, - MemorySwap: 0, - AttachStdin: false, - AttachStdout: false, - AttachStderr: false, - PortSpecs: null, - Tty: false, - OpenStdin: false, - StdinOnce: false, - Env: null, - Cmd: [ - "/bin/bash", - "-c", - "apt-get -q -yy -f install libevent-dev" - ], - Dns: null, - Image: "imagename/blah", - Volumes: { }, - VolumesFrom: "" - }, - docker_version: "0.1.7" - } + {layer binary data stream} :parameter image_id: the id for the layer you want to get @@ -193,13 +133,38 @@ Image Cookie: (Cookie provided by the Registry) { - “id”: “088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c”, - “checksum”: “sha256:b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087” - } + id: "088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c", + parent: "aeee6396d62273d180a49c96c62e45438d87c7da4a5cf5d2be6bee4e21bc226f", + created: "2013-04-30T17:46:10.843673+03:00", + container: "8305672a76cc5e3d168f97221106ced35a76ec7ddbb03209b0f0d96bf74f6ef7", + container_config: { + Hostname: "host-test", + User: "", + Memory: 0, + MemorySwap: 0, + AttachStdin: false, + AttachStdout: false, + AttachStderr: false, + PortSpecs: null, + Tty: false, + OpenStdin: false, + StdinOnce: false, + Env: null, + Cmd: [ + "/bin/bash", + "-c", + "apt-get -q -yy -f install libevent-dev" + ], + Dns: null, + Image: "imagename/blah", + Volumes: { }, + VolumesFrom: "" + }, + docker_version: "0.1.7" + } :parameter image_id: the id for the layer you want to get - **Example Response**: .. sourcecode:: http @@ -238,11 +203,39 @@ Image Vary: Accept Content-Type: application/json X-Docker-Registry-Version: 0.6.0 + X-Docker-Size: 456789 + X-Docker-Checksum: b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087 { - “id”: “088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c”, - “checksum”: “sha256:b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087” - } + id: "088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c", + parent: "aeee6396d62273d180a49c96c62e45438d87c7da4a5cf5d2be6bee4e21bc226f", + created: "2013-04-30T17:46:10.843673+03:00", + container: "8305672a76cc5e3d168f97221106ced35a76ec7ddbb03209b0f0d96bf74f6ef7", + container_config: { + Hostname: "host-test", + User: "", + Memory: 0, + MemorySwap: 0, + AttachStdin: false, + AttachStdout: false, + AttachStderr: false, + PortSpecs: null, + Tty: false, + OpenStdin: false, + StdinOnce: false, + Env: null, + Cmd: [ + "/bin/bash", + "-c", + "apt-get -q -yy -f install libevent-dev" + ], + Dns: null, + Image: "imagename/blah", + Volumes: { }, + VolumesFrom: "" + }, + docker_version: "0.1.7" + } :statuscode 200: OK :statuscode 401: Requires authorization @@ -319,7 +312,7 @@ Ancestry { "latest": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f", - “0.1.1”: “b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087” + "0.1.1": "b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087" } :statuscode 200: OK @@ -409,7 +402,7 @@ Ancestry Content-Type: application/json Cookie: (Cookie provided by the Registry) - “9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f” + "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f" :parameter namespace: namespace for the repo :parameter repository: name for the repo From 818ec10da3813dfd582450093739cc4619e99b6d Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Thu, 26 Sep 2013 01:19:49 -0700 Subject: [PATCH 3/4] Fix Authorization headers --- docs/sources/api/registry_api.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sources/api/registry_api.rst b/docs/sources/api/registry_api.rst index 94e1c3b3e0..ad5c9db133 100644 --- a/docs/sources/api/registry_api.rst +++ b/docs/sources/api/registry_api.rst @@ -61,7 +61,7 @@ Layer Host: registry-1.docker.io Accept: application/json Content-Type: application/json - Authorization: Token signature=3200f02,repository="namespace/user",access=write' + Authorization: Token signature=123abc,repository="foo/bar",access=read :parameter image_id: the id for the layer you want to get @@ -92,7 +92,7 @@ Layer PUT /v1/images/088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c/layer HTTP/1.1 Host: registry-1.docker.io Transfer-Encoding: chunked - Authorization: Token signature=3200f02,repository="namespace/user",access=write' + Authorization: Token signature=123abc,repository="foo/bar",access=write {layer binary data stream} From ce05083d4bd78a8c8272742095cf662fa86739ef Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Thu, 26 Sep 2013 14:57:02 -0700 Subject: [PATCH 4/4] Fix copypasta errors --- docs/sources/api/index_api.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sources/api/index_api.rst b/docs/sources/api/index_api.rst index b992712fc3..f89a3f075d 100644 --- a/docs/sources/api/index_api.rst +++ b/docs/sources/api/index_api.rst @@ -94,7 +94,7 @@ User Repo Vary: Accept Content-Type: application/json WWW-Authenticate: Token signature=123abc,repository="foo/bar",access=delete - X-Docker-Token: signature=123abc,repository="foo/bar",access=write + X-Docker-Token: signature=123abc,repository="foo/bar",access=delete X-Docker-Endpoints: registry-1.docker.io [, registry-2.docker.io] "" @@ -178,7 +178,7 @@ Library Repo Vary: Accept Content-Type: application/json WWW-Authenticate: Token signature=123abc,repository="library/foobar",access=delete - X-Docker-Token: signature=123abc,repository="foo/bar",access=write + X-Docker-Token: signature=123abc,repository="foo/bar",access=delete X-Docker-Endpoints: registry-1.docker.io [, registry-2.docker.io] ""