How we automate container updates on mittwald
We run several containers on mittwald - mainly Solr and n8n instances for various projects.
Container images get regular updates with new features and security patches. Clicking 'update' in the mittwald interface works fine for one or two containers, but becomes tedious when you're managing multiple projects.
Since we use :latest tags deliberately, we built a simple cron solution to handle updates automatically.
Setup requirements
You'll need a dedicated project to run the cron job:
- Create a static site project (we only use it as execution environment)
- Add Node.js via software management
- SSH access to the project
- Install the mittwald CLI:
npm install -g @mittwald/cli - Generate an API token with write permissions:
- Authenticate with your token:
mw login token
Finding your project and container IDs
Each container update requires both project-id and container-id. Get them via CLI or mittwald's interface.
List all projects:
mw project list
Show containers for a specific project:
mw container ls --project-id <project-id>
Alternatively, grab the IDs from the mittwald dashboard - they're visible in the URL or container details.
The update command
Updating a container is straightforward:
mw container recreate <container-id> --pull --project-id <project-id>
The --pull flag ensures you get the latest image
recreate gives you a clean container restart
Automating with cron
We wrap the command in a simple bash script:
#!/bin/sh
exec /files/.mwsoftware/node/bin/mw container recreate $1 --pull --project-id $2Now we can call this script from cron with different container and project IDs. Makes it easy to update multiple containers across different projects automatically.
A word of caution
Using :latest tags is convenient but requires some thought. If you're running databases or services with strict version dependencies, automatic updates might break things.
Also consider when to run updates - we usually schedule them during low-traffic hours.
This approach works well for our internal tools where brief downtime isn't critical.
For non-mittwald setups
When we're running containers elsewhere, we use WUD (What's up Docker) for monitoring and updates.
Please feel free to share this article.






Comments
No comments yet.