You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cada4d2
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/project/API.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ Fields:
40
40
-`container_name`: Docker container name without leading `/`
41
41
-`local_digest`: shortened local digest or `unknown`
42
42
-`status`: `uptodate`, `outdated`, or `unknown`
43
-
-`auto_update`: persisted toggle state for this container
43
+
-`auto_update`: read from Docker label `image-watch.auto-update` on the container
44
44
45
45
### `PullProgress`
46
46
@@ -109,7 +109,7 @@ curl -X POST http://localhost:8099/api/images/3d4c5b6a7f8e/update
109
109
110
110
### `POST /api/images/{id}/auto-update`
111
111
112
-
Toggle auto-update for given container.
112
+
Returns the current auto-update state for the given container, read from the Docker label `image-watch.auto-update`. The endpoint is read-only — enable/disable by setting the label on the container definition.
113
113
114
114
Success response:
115
115
@@ -218,7 +218,7 @@ Common errors emitted by handlers:
218
218
| Status | Body | When |
219
219
|---|---|---|
220
220
|`400`|`bad path: /api/images/{id}/{action}\n`| Path after `/api/images/` does not contain exactly `{id}/{action}`|
221
-
|`400`|`unknown action\n`| Action is not `update`, `auto-update`, or `progress`|
221
+
|`400`|`unknown action\n`| Action is not `update`, `auto-update`, or `progress`(`auto-update` is now read-only) |
222
222
|`404`|`container not found\n`| Container ID is not present in current `app.images` snapshot |
223
223
|`404`|`no progress\n`| No active progress snapshot for given container |
224
224
|`405`|`method not allowed\n`| Wrong HTTP method used for endpoint |
Copy file name to clipboardExpand all lines: docs/project/AUTO-UPDATE.md
+18-23Lines changed: 18 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,36 +2,31 @@
2
2
3
3
## How It Is Enabled
4
4
5
-
Auto-update can be toggled:
5
+
Auto-update is controlled via the Docker label `image-watch.auto-update` on the container.
6
6
7
-
- from web UI toggle in `web/index.html`
8
-
- via `POST /api/images/{id}/auto-update`
7
+
To enable, add the label to your container or service:
9
8
10
-
Toggle state is returned as:
11
-
12
-
```json
13
-
{"auto_update":true}
9
+
```yaml
10
+
services:
11
+
my-service:
12
+
labels:
13
+
- "image-watch.auto-update=true"
14
14
```
15
15
16
-
## Persistence Model
16
+
The label is **declarative**: it survives every recreate (manual or automatic) because `recreateContainer()` copies existing labels from the old container to the new one during `inspect -> stop -> remove -> create -> start`.
17
17
18
-
State is stored as JSON map in `AUTO_FILE`.
18
+
The web UI displays the current auto-update state (read from the label) but does not allow toggling — the label must be set in the container definition (e.g., `docker-compose.yml`).
19
19
20
-
Example:
20
+
The `POST /api/images/{id}/auto-update` endpoint still returns the current state, but does not modify it.
21
21
22
-
```json
23
-
{
24
-
"3d4c5b6a7f8e": true,
25
-
"9f8e7d6c5b4a": false
26
-
}
27
-
```
22
+
## Why Labels Instead of a File
28
23
29
-
Implementation points:
24
+
| Approach | Survives recreate? | Declarative? |
25
+
|---|---|---|
26
+
| `auto-update.json` (previous) | No — new container ID = lost state | No |
27
+
| Docker label `image-watch.auto-update` (current) | Yes — labels are copied on recreate | Yes |
30
28
31
-
-`App.autoSaved` keeps in-memory map
32
-
-`loadAuto()` reads file on startup
33
-
-`saveAuto()` writes file after each toggle
34
-
- keys use short 12-character container IDs
29
+
This makes auto-update a true lifecycle feature rather than a one-shot toggle.
35
30
36
31
## Check Interval
37
32
@@ -57,13 +52,13 @@ This avoids repeated rapid recreate cycles when a container stays reported as ou
57
52
Auto-update only triggers when all conditions are true:
58
53
59
54
- container appears in current running container list
60
-
-auto-update is enabled for that container
55
+
- container has label `image-watch.auto-update=true`
61
56
- computed status is `outdated`
62
57
- no active cooldown (default 5 min, configurable via `AUTO_COOLDOWN`) blocks that container
63
58
64
59
## Concurrency and State Safety
65
60
66
-
-`sync.RWMutex` protects `images`, `autoSaved`, and `cooldowns`
61
+
- `sync.RWMutex`protects `images` and `cooldowns`
67
62
- `sync.Map`stores pull progress snapshots
68
63
- route-triggered manual updates run in goroutines
69
64
- cooldown tracking reduces risk of concurrent repeated auto-updates for same container
0 commit comments