-
Notifications
You must be signed in to change notification settings - Fork 7
Description
I can successfully create a new container via the Container Factory API, but when I try to update an existing container’s image using the Update Manager API over MQTT, nothing happens. The container-management service restarts the old containers but does not pull or run the new image.
Create a new nginx container (works):
mosquitto_pub -h localhost
-t "command//edge:mydevice:edge:containers/req//create"
-m '{
"topic":"edge/mydevice:edge:containers/things/live/messages/create",
"headers":{"response-required":true,"content-type":"application/json","correlation-id":"create-nginx-001"},
"path":"/features/ContainerFactory/inbox/messages/create",
"value":{"imageRef":"docker.io/library/nginx:1.27.5-alpine3.21","cmd":["nginx","-g","daemon off;"],"start":true}
}'
Verify container is running
sudo kanto-cm list
→ ID 91226b32… | nginx:1.27.5-alpine3.21 | Running
Attempt to update that container’s image (fails):
Publish desired state to Update Manager
mosquitto_pub -h localhost
-t "edge/update/desiredstate"
-m '{
"activityId":"update-nginx-to-perl-001",
"timestamp":'"$(date +%s%3N)"',
"payload":{"desiredState":{
"domains":[{"id":"containers","components":[{
"id":"containers:91226b32-8580-4b99-acc7-65e53a7a21ab",
"parameters":[
{"key":"image","value":"docker.io/library/nginx:stable-alpine3.20-perl"},
{"key":"status","value":"Running"}
]
}]}]
}}
}'
mosquitto_sub -h localhost -t "#" -v
edge/connection/remote/status {"connected":false,"cause":"CONNECTION_UNKNOWN"}
containersupdate/currentstate {"activityId":"initial-current-state-1745317458281","timestamp":1745317458281,"payload":{"softwareNodes":[{"id":"containers-update-agent","version":"1.0.0","name":"Eclipse Kanto Containers Update Agent","parameters":[{"key":"domain","value":"containers"}],"type":"APPLICATION"},{"id":"containers:17438356-c21f-42a2-9cc5-54b8287115f3","version":"latest","parameters":[{"key":"image","value":"docker.io/library/alpine:latest"},{"key":"status","value":"Running"},{"key":"created","value":"2025-04-15T11:36:11.417958183Z"}],"type":"CONTAINER"},{"id":"containers:ffbd5091-caa7-4d6f-b7cc-810028957d52","version":"latest","parameters":[{"key":"image","value":"docker.io/library/hello-world:latest"},{"key":"status","value":"Running"},{"key":"created","value":"2025-04-15T11:29:49.909911421Z"}],"type":"CONTAINER"}],"associations":[{"sourceId":"containers-update-agent","targetId":"containers:17438356-c21f-42a2-9cc5-54b8287115f3"},{"sourceId":"containers-update-agent","targetId":"containers:ffbd5091-caa7-4d6f-b7cc-810028957d52"}]}}
edge/update/desiredstate {
"activityId":"update-nginx-to-perl-001",
"timestamp":1745323095877,
"payload":{"desiredState":{
"domains":[{"id":"containers","components":[{
"id":"containers:91226b32-8580-4b99-acc7-65e53a7a21ab",
"parameters":[
{"key":"image","value":"docker.io/library/nginx:stable-alpine3.20-perl"},
{"key":"status","value":"Running"}
]
}]}]
}}
}
e/edge/edge:mydevice:edge:containers {"topic":"edge/mydevice:edge:containers/things/twin/commands/modify","headers":{"response-required":false},"path":"/features/Container:ffbd5091-caa7-4d6f-b7cc-810028957d52/properties/status/state","value":{"status":"RUNNING","pid":20165,"startedAt":"2025-04-22T11:58:20.543701877Z","finishedAt":"2025-04-22T11:57:19.6927593Z"}}
e/edge/edge:mydevice:edge:containers {"topic":"edge/mydevice:edge:containers/things/twin/commands/modify","headers":{"response-required":false},"path":"/features/Container:17438356-c21f-42a2-9cc5-54b8287115f3/properties/status/state","value":{"status":"RUNNING","pid":20178,"startedAt":"2025-04-22T11:58:20.555080091Z","finishedAt":"2025-04-22T11:57:19.69866319Z"}}
e/edge/edge:mydevice:edge:containers {"topic":"edge/mydevice:edge:containers/things/twin/commands/modify","headers":{"response-required":false},"path":"/features/Container:ffbd5091-caa7-4d6f-b7cc-810028957d52/properties/status/state","value":{"status":"EXITED","pid":-1,"startedAt":"2025-04-22T11:58:20.543701877Z","finishedAt":"2025-04-22T11:58:20.802617013Z"}}
e/edge/edge:mydevice:edge:containers {"topic":"edge/mydevice:edge:containers/things/twin/commands/modify","headers":{"response-required":false},"path":"/features/Container:17438356-c21f-42a2-9cc5-54b8287115f3/properties/status/state","value":{"status":"EXITED","pid":-1,"startedAt":"2025-04-22T11:58:20.555080091Z","finishedAt":"2025-04-22T11:58:20.80867129Z"}}
Could you please help me to publish a MQTT message to update my container ?