> For the complete documentation index, see [llms.txt](https://docs.ionos.com/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionos.com/cloud/api-reference/containers/private-container-registry/registries/create-or-replace-a-container-registry.md).

# Create or replace a container registry

Create/replace a registry to hold container images or OCI compliant artifacts **On create**

* "name" must have passed validation
* "location" must be one of the available location IDs **On update**
* "name" cannot be changed
* "location" cannot be changed **On create or update**
* "garbageCollectionSchedule": time and days of the week for runs

```json
{"openapi":"3.0.3","info":{"title":"Container Registry service","version":"1.2.2"},"tags":[{"name":"Registries","description":"Manage container registries for storage of docker images and OCI compliant artifacts. This operation is restricted to contract owner, admin, and users with 'accessAndManageRegistries' and Share/Edit access permissions for the data center hosting the registry.\nThis tag groups all operations for registries.\n"}],"servers":[{"url":"https://api.ionos.com/containerregistries","description":"Production"}],"security":[{"basicAuth":[]},{"tokenAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic","description":"You will need to base64 encode the string containing your credentials. Separate your username and password with a colon, i.e., username:password and send it as 'Authorization' request header. More details: https://en.wikipedia.org/wiki/Basic_access_authentication"},"tokenAuth":{"type":"apiKey","name":"Authorization","in":"header","description":"Please provide header value as 'Bearer' and don't forget to add 'Bearer' HTTP Authorization Scheme before the token        "}},"schemas":{"PutRegistryInput":{"required":["properties"],"type":"object","properties":{"properties":{"$ref":"#/components/schemas/PostRegistryProperties"}}},"PostRegistryProperties":{"required":["name","location"],"type":"object","properties":{"garbageCollectionSchedule":{"$ref":"#/components/schemas/WeeklySchedule"},"location":{"type":"string"},"name":{"pattern":"^[a-z][-a-z0-9]{1,61}[a-z0-9]$","type":"string"},"features":{"$ref":"#/components/schemas/RegistryFeatures"},"apiSubnetAllowList":{"$ref":"#/components/schemas/APISubnetAllowList"}}},"WeeklySchedule":{"required":["days","time"],"type":"object","properties":{"days":{"type":"array","items":{"$ref":"#/components/schemas/Day"},"nullable":true},"time":{"type":"string","description":"UTC time of day e.g. 01:00:00 - as defined by partial-time - RFC3339","format":"time"}},"nullable":true},"Day":{"enum":["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],"type":"string"},"RegistryFeatures":{"type":"object","properties":{"vulnerabilityScanning":{"$ref":"#/components/schemas/FeatureVulnerabilityScanning"}},"description":"Optional registry features.  __Note__: some may incur additional charges - see individual feature descriptions for details"},"FeatureVulnerabilityScanning":{"description":"Vulnerability scanning for images.  __Note__: this is a paid add-on","allOf":[{"$ref":"#/components/schemas/Feature"}]},"Feature":{"type":"object","description":"An optional registry feature","required":["enabled"],"properties":{"enabled":{"type":"boolean","default":true},"properties":{"type":"object"}}},"APISubnetAllowList":{"type":"array","description":"Subnets and IPs that are allowed to access the registry API, supports IPv4 and IPv6.\nMaximum of 25 items may be specified.\nIf no CIDR is given /32 and /128 are assumed for IPv4 and IPv6 respectively.\n0.0.0.0/0 can be used to deny all traffic.\n__Note__: If this list is empty or not set, there are no restrictions.\n","items":{"type":"string","pattern":"(^((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(/([0-9]|[1-2][0-9]|3[0-2]))?$)|(^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))(/([0-9]|[0-9][0-9]|1[0-1][0-9]|12[0-8]))?$)"},"minItems":0,"maxItems":25,"nullable":true},"PutRegistryOutput":{"required":["metadata","properties"],"type":"object","properties":{"href":{"type":"string"},"id":{"type":"string","format":"uuid"},"metadata":{"$ref":"#/components/schemas/ApiResourceMetadata"},"properties":{"$ref":"#/components/schemas/RegistryProperties"},"type":{"type":"string"}}},"ApiResourceMetadata":{"title":"Metadata","required":["createdBy","createdByUserId","createdDate","state"],"type":"object","properties":{"createdBy":{"type":"string"},"createdByUserId":{"type":"string"},"createdDate":{"type":"string","format":"date-time"},"lastModifiedBy":{"type":"string"},"lastModifiedByUserId":{"type":"string"},"lastModifiedDate":{"type":"string","format":"date-time","nullable":true},"state":{"type":"string"}},"nullable":true},"RegistryProperties":{"required":["name","location"],"type":"object","properties":{"garbageCollectionSchedule":{"$ref":"#/components/schemas/WeeklySchedule"},"hostname":{"type":"string"},"location":{"type":"string"},"name":{"pattern":"^[a-z][-a-z0-9]{1,61}[a-z0-9]$","type":"string"},"storageUsage":{"$ref":"#/components/schemas/StorageUsage"},"features":{"$ref":"#/components/schemas/RegistryFeatures"},"apiSubnetAllowList":{"$ref":"#/components/schemas/APISubnetAllowList"}},"nullable":true},"StorageUsage":{"required":["bytes"],"type":"object","properties":{"bytes":{"type":"integer","nullable":true,"format":"int64"},"updatedAt":{"type":"string","format":"date-time","nullable":true}},"nullable":true},"ApiErrorResponse":{"required":["httpStatus","messages"],"type":"object","properties":{"httpStatus":{"type":"integer"},"messages":{"type":"array","items":{"$ref":"#/components/schemas/ApiErrorMessage"},"nullable":true}}},"ApiErrorMessage":{"required":["errorCode","message"],"type":"object","properties":{"errorCode":{"type":"string"},"message":{"type":"string"}}}}},"paths":{"/registries/{registryId}":{"put":{"tags":["Registries"],"summary":"Create or replace a container registry","description":"Create/replace a registry to hold container images or OCI compliant\nartifacts\n**On create**\n- \"name\" must have passed validation\n- \"location\" must be one of the available location IDs\n**On update**\n- \"name\" cannot be changed\n- \"location\" cannot be changed\n**On create or update**\n- \"garbageCollectionSchedule\": time and days of the week for runs\n","operationId":"registriesPut","parameters":[{"name":"registryId","in":"path","description":"The unique ID of the registry","required":true,"schema":{"pattern":"^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$","type":"string","format":"uuid","description":"The unique ID of the registry"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutRegistryInput"}}},"required":true},"responses":{"201":{"description":"The created container registry is returned with 'metadata.status' set to \"BUSY\".","headers":{"Location":{"style":"simple","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutRegistryOutput"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.ionos.com/cloud/api-reference/containers/private-container-registry/registries/create-or-replace-a-container-registry.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
