새 리포지토리 생성
새 리포지토리 생성
지정한 네임스페이스 안에 새 리포지토리를 만들어요. 이름, 설명, 공개 설정 등 제공된 메타데이터로 리포지토리가 생성돼요. 이 작업은 조직 액세스 토큰(OAT)에서 발급한 bearer 토큰을 받아요.
출처: 문서
본문
POST /v2/namespaces/{namespace}/repositories
새 리포지토리 생성 작업이에요. 지정한 네임스페이스 안에 새 리포지토리를 만들어요. 이름, 설명, 공개 설정 등 제공된 메타데이터로 리포지토리가 생성돼요. 이 작업은 조직 액세스 토큰(OAT)에서 발급한 bearer 토큰을 받아요.
요청 예시
실행 전에 자리 표시자를 바꾸고 필요 자격 증명이나 요청 바디를 채워야 해요.
curl \
--request POST \
--header "Authorization: Bearer ${TOKEN}" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"description": "A sample application repository",
"full_description": "This is a comprehensive description of my application repository that contains additional details about the project.",
"is_private": false,
"name": "my-app",
"namespace": "myorganization",
"registry": "docker.io"
}' \
'https://hub.docker.com/v2/namespaces/<NAMESPACE>/repositories'
요청과 응답
응답 201 Repository created successfully
Schema:
{
"$ref": "#/components/schemas/repository_info"
}
Example:
{
"categories": [],
"collaborator_count": 0,
"content_types": [],
"date_registered": "2025-01-20T10:30:00Z",
"description": "A sample application repository",
"full_description": "This is a comprehensive description of my application repository that contains additional details about the project.",
"has_starred": false,
"hub_user": "myorganization",
"immutable_tags_settings": {
"enabled": false,
"rules": []
},
"is_automated": false,
"is_private": false,
"last_updated": "2025-01-20T10:30:00Z",
"media_types": [],
"name": "my-app",
"namespace": "myorganization",
"permissions": {
"admin": true,
"read": true,
"write": true
},
"pull_count": 0,
"repository_type": "image",
"source": null,
"star_count": 0,
"status": 1,
"status_description": "Active",
"storage_size": null,
"user": "myorganization"
}
응답 400 Bad Request
Schema:
{
"$ref": "#/components/schemas/error"
}
error:
{
"errinfo": null,
"message": "bad request"
}
응답 401 Unauthorized
Schema:
{
"$ref": "#/components/schemas/error"
}
error:
{
"errinfo": null,
"message": "unauthorized"
}
응답 403 Forbidden
Schema:
{
"$ref": "#/components/schemas/error"
}
error:
{
"errinfo": null,
"message": "permission denied"
}
응답 404 Not Found
Schema:
{
"$ref": "#/components/schemas/error"
}
error:
{
"errinfo": null,
"message": "not found"
}
응답 500 Internal
Schema:
{
"$ref": "#/components/schemas/error"
}
error:
{
"errinfo": null,
"message": "internal error"
}
전체 작업 계약
{
"description": "Creates a new repository within the specified namespace. The repository will be created\nwith the provided metadata including name, description, and privacy settings.\n\nThis operation accepts bearer tokens issued from organization access tokens (OATs). The token must have the required resource access and scopes.\n",
"operationId": "CreateRepository",
"requestBody": {
"content": {
"application/json": {
"example": {
"description": "A sample application repository",
"full_description": "This is a comprehensive description of my application repository that contains additional details about the project.",
"is_private": false,
"name": "my-app",
"namespace": "myorganization",
"registry": "docker.io"
},
"schema": {
"$ref": "#/components/schemas/repo_creation_request"
}
}
},
"required": true
},
"responses": {
"201": {
"content": {
"application/json": {
"example": {
"categories": [],
"collaborator_count": 0,
"content_types": [],
"date_registered": "2025-01-20T10:30:00Z",
"description": "A sample application repository",
"full_description": "This is a comprehensive description of my application repository that contains additional details about the project.",
"has_starred": false,
"hub_user": "myorganization",
"immutable_tags_settings": {
"enabled": false,
"rules": []
},
"is_automated": false,
"is_private": false,
"last_updated": "2025-01-20T10:30:00Z",
"media_types": [],
"name": "my-app",
"namespace": "myorganization",
"permissions": {
"admin": true,
"read": true,
"write": true
},
"pull_count": 0,
"repository_type": "image",
"source": null,
"star_count": 0,
"status": 1,
"status_description": "Active",
"storage_size": null,
"user": "myorganization"
},
"schema": {
"$ref": "#/components/schemas/repository_info"
}
}
},
"description": "Repository created successfully"
},
"400": {
"$ref": "#/components/responses/bad_request"
},
"401": {
"$ref": "#/components/responses/unauthorized"
},
"403": {
"$ref": "#/components/responses/forbidden"
},
"404": {
"$ref": "#/components/responses/not_found"
},
"500": {
"$ref": "#/components/responses/internal_error"
}
},
"security": [
{
"bearerAuth": []
}
],
"summary": "Create a new repository",
"tags": [
"repositories"
]
}