> For the complete documentation index, see [llms.txt](https://docs-epc.gitbook.io/ncs-documents/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-epc.gitbook.io/ncs-documents/compute/compute-instance/setup-docker-image-caching.md).

# Setup Docker Image Caching

## Prerequisite

* ต้องมี instance อยู่ใน project หากไม่มี ศึกษาได้จาก [ขั้นตอนการ launch instance](/ncs-documents/compute/compute-instance/launch-compute-instance.md)

{% hint style="info" %}
ถ้า launch instance ด้วย **distribution image** ที่ทาง NIPA Cloud Space เตรียมไว้ให้ Docker Image Caching จะถูก enable ไว้แล้ว ไม่จำเป็นต้อง setting เพิ่ม

![](/files/R22cmF31vcp240KfQkab)
{% endhint %}

## Instructions

สำหรับ image ที่ไม่ใช่ distribution image จะต้อง config registry mirror ไปที่ [https://registry-cache.nipa.cloud ](<https://registry-cache.nipa.cloud >)

### 1. แก้ไข file docker config

Access เข้าแก้ไข file /etc/docker/daemon.json โดยใช้ command&#x20;

```
$nano /etc/docker/daemon.json
```

และเพิ่มค่าดังนี้ลงไปใน file&#x20;

```
{
    "registry-mirror": "https://registry-cache.nipa.cloud"
}
```

จากนั้นออกจาก editor และ save file

### 2. Restart Docker service

Restart Docker service โดยใช้ command&#x20;

```
systemctl restart docker.service
```

### 3. ตรวจสอบผลการ config&#x20;

ตรวจสอบว่า config เสร็จเรียบร้อยดีหรือไม่ โดยใช้ command&#x20;

```
docker info
```

registry mirrors ควรแสดงดังรูปด้านล่าง ก็เป็นอันเสร็จสิ้น\
![](/files/yhAH9NQ17u1W9O0knvto)<br>
