# Gyro image registry: docker login, push, quota and automatic clean-up

https://www.gyrohosting.com/en/knowledgebase/article/gyro-containers-image-registry

- **What you will learn**: How to push your images to Gyro's private registry, the quota and price, the automatic clean-up setting, deleting images and rotating the password.
- **Time**: 10 minutes
- **Who this is for**: Developers who want to store their images at Gyro.
- **What you need**: A Gyro Containers environment and Docker on your computer.

## 1. What is the image registry?

Every Gyro Containers environment includes a **private image registry** that only that environment can read and write. The address is `registry.ist.gyrohosting.com`. You push your images there and use them in your service with the same address; you do not need to define separate registry credentials.

> **Info**
> 
> Pulling images from external registries such as Docker Hub and GitHub is **free and unrestricted**; the Gyro registry is optional. You cannot access other customers' images, and they cannot access yours.

## 2. Log in and push an image

1. Open the **Image Registry** page of your environment. In the **Access** section you see the registry address, the **user name** and the **image name prefix** (`registry.ist.gyrohosting.com/<your-code>/`).
2. Reveal the password with **Show** and copy it. Store it as a secret variable in CI/CD.
3. Log in on your computer (give the password on stdin instead of typing it in the command):

```
echo "$GYRO_REGISTRY_PASSWORD" | docker login registry.ist.gyrohosting.com \
  --username <user-shown-in-panel> --password-stdin
```

1. Tag your image **with your code prefix** and push:

```
docker build -t registry.ist.gyrohosting.com/<your-code>/web:1.0 .
docker push registry.ist.gyrohosting.com/<your-code>/web:1.0
```

1. You see the image in the **Images** list. When creating or updating a service write the same address in **Image**: `registry.ist.gyrohosting.com/<your-code>/web:1.0`.

> **Warning**
> 
> You can write only to repositories under **your code prefix** (`<your-code>/…`). A `push` with another prefix is rejected. If authentication errors repeat many times, login is briefly rate-limited.

## 3. Quota and price

- **2 GB free per environment.** Above that **0.05 €/GB per month** (TRY at the current rate, excluding VAT); calculated hourly and deducted from your balance. Example: 3.4 GB = (3.4 − 2) × 0.05 = 0.07 €/month.
- **50 GB cap.** When you reach it, or while the service is suspended, pushing new images is closed; it reopens when you delete old images.
- **Measurement:** usage is measured about every 30 minutes. Images sharing a layer count it once. On the Spending page you see a separate item such as **Image registry · 3.4 GB (−2 GB)**.
- When the environment is deleted, all images in the registry are deleted too.

## 4. Automatic clean-up

So the registry does not fill up, **automatic clean-up is on by default**:

- Images used in each service's **last 10 revisions** and **the image running now** are kept.
- Tags used in no revision and **older than 7 days** are deleted.

In the **Automatic clean-up** section of the **Image Registry** page you can change **Revisions kept** (1-50) and **Unused (days)** (1-90) or turn clean-up off.

```
gyro container registry get 12345
gyro container registry images 12345
gyro container registry policy 12345 --keep 5 --untagged-days 3
```

> **Info**
> 
> Even if deleted revisions still appear in the rollback list, you cannot roll back to a revision whose image is no longer in the registry. Keep the images of revisions you may need to return to, or keep **Revisions kept** high.

## 5. Deleting images and rotating the password

- **Deleting an image:** use the delete button next to the image in the **Images** list, or `gyro container registry image-delete 12345 --repo web --tag 1.0`. An image used by a service **cannot be deleted** ("in use").
- **Rotating the password:** **Rotate password** generates a new password; **the old one stops working at once**, so update your CI settings. Running services are not affected.

```
gyro container registry rotate 12345
```

## 6. Frequently asked questions

**I get "unauthorized"; what should I do?**

Run `docker login` first; make sure the user name and password belong to this environment and the image name has the form `registry.ist.gyrohosting.com/<your-code>/…`. If you rotated the password, update the CI setting.

**The push was rejected with "denied"; what should I do?**

The prefix is wrong or pushing new images is closed (50 GB cap or suspension).

**If I push the same image twice, am I charged twice?**

No; identical layers count once, and only the sum of unique layers is measured.

**How do I back up the images in the registry?**

The registry is part of the environment and has no backup commitment. You should be able to rebuild important images from your own source repository.

## Next step

- [Variables and secrets](https://www.gyrohosting.com/en/knowledgebase/article/gyro-containers-variables-and-secrets)
- [Deploy with GitHub Actions](https://www.gyrohosting.com/en/knowledgebase/article/gyro-containers-github-actions)
