upgrade
rfswift upgrade
Upgrade containers to newer image versions while preserving selected data directories.
Synopsis
rfswift upgrade -c CONTAINER_NAME [-i IMAGE_NAME] [-r REPOSITORIES]The upgrade command follows this pattern: pull new image → create new container → copy preserved directories → inherit original container name. This enables seamless version upgrades while maintaining important data.
Options
| Flag | Description | Required | Example |
|---|---|---|---|
-c, --container STRING |
Container name or ID to upgrade | Yes | -c my_container |
-i, --image STRING |
Target image name/tag | No (defaults to latest) | -i telecom_15012025 |
-r, --repositories STRING |
Comma-separated directories to preserve | No | -r /root/tools,/opt/data |
Examples
Basic Usage
Upgrade to latest version:
rfswift upgrade -c my_containerUpgrade to specific version:
rfswift upgrade -c sdr_work -i penthertz/rfswift_noble:sdr_fullUpgrade with preserved directories:
rfswift upgrade -c analysis_work \
-i penthertz/rfswift_noble:sdr_full \
-r /root/scripts,/root/captures,/opt/toolsDowngrade to previous version:
rfswift upgrade -c production -i penthertz/rfswift_noble:v0.6.4How Upgrade Works
Upgrade Process
The upgrade command follows this sequence:
- Validate: Check source container exists
- Pull: Download target image (if not present locally)
- Create: Start new container from target image
- Copy: Transfer preserved directories from old to new container
- Stop: Stop old container
- Rename: Rename old container (adds
_oldsuffix) - Inherit: New container inherits original name
- Cleanup: Old container remains stopped for verification
graph LR
A[Old Container] -->|Pull Image| B[New Image]
B -->|Create| C[New Container]
A -->|Copy Directories| C
A -->|Stop & Rename| D[Old Container_old]
C -->|Inherit Name| E[New Container with Original Name]
What Gets Preserved
| Content | Preserved? | How |
|---|---|---|
Directories in -r flag |
✅ Yes | Copied to new container |
| Files in preserved dirs | ✅ Yes | Complete copy |
| Other directories | ❌ No | Use new image defaults |
| Container name | ✅ Yes | Inherited by new container |
| Volume bindings | ✅ Yes | Automatically inherited |
| Network settings | ✅ Yes | Automatically inherited |
| Port bindings | ✅ Yes | Automatically inherited |
| Device mappings | ✅ Yes | Automatically inherited |
| Capabilities | ✅ Yes | Automatically inherited |
| Cgroup rules | ✅ Yes | Automatically inherited |
| Environment variables | ✅ Yes | Automatically inherited |
| Privileged mode | ✅ Yes | Automatically inherited |
| Seccomp profile | ✅ Yes | Automatically inherited |
The upgrade command now automatically preserves all host bindings, network settings, device mappings, capabilities, cgroup rules, and port bindings from the original container. A timestamped backup image is created before the old container is removed.
What Doesn’t Get Preserved
- ❌ Files outside of
-rdirectories (new image defaults apply) - ❌ Running processes (container is restarted fresh)
Troubleshooting
Container Not Found
Error: Error: No such container: container_name
Solutions:
# List containers
rfswift lastImage Pull Failed
Error: Error pulling image
Solutions:
# Check network connectivity
ping registry.hub.docker.com
# Pull manually first
docker pull penthertz/rfswift_noble:sdr_full
# Retry upgrade
rfswift upgrade -c container -i penthertz/rfswift_noble:sdr_fullPreserved Directory Not Found
Error: Directory /root/nonexistent not found in source container
Solutions:
# Check what directories exist
rfswift exec -c old_container
ls -la /root/
exit
# Adjust -r flag to existing directories only
rfswift upgrade -c container -r /root/existing,/opt/toolsOld Container Still Running
Problem: Upgrade completes but old container still active
Solution:
# Stop old container manually
rfswift stop -c container_old
# Verify new container is running
docker ps | grep container
# Remove old container when satisfied
rfswift remove -c container_oldConfiguration Lost After Upgrade
Problem: Network/volume/device settings missing after upgrade
Note: This should no longer occur — RF Swift now automatically preserves all container settings (bindings, devices, network, capabilities, cgroups, ports) during upgrade. If you experience this issue, ensure you’re running the latest version of RF Swift.
Workaround (for older versions):
# Document current configuration before upgrade
docker inspect old_container > old_container_config.json
# After upgrade, reconfigure manually
rfswift bindings add -c container -s ~/data -t /root/data
rfswift capabilities add -c container -p NET_ADMIN
rfswift cgroups add -c container -r "c 189:* rwm"
rfswift ports bind -c container -b "8080:8080/tcp"Rollback Failed
Problem: Can’t restore old container after bad upgrade
Solution:
# If you have backup
rfswift import container -i backup.tar.gz -n container_restored
rfswift run -i container_restored -n container
# If old container still exists
rfswift remove -c container # Remove bad new container
rfswift rename -n container_old -d container
rfswift exec -c containerRelated Commands
run- Create new containerscommit- Save container state before upgradeexport- Backup before upgradeimport- Restore from backup if upgrade failsimages- Check available images for upgrade
export container. This allows easy rollback if the upgrade has issues. The old container is kept as container_old for verification.-r flag to preserve only necessary directories. Preserving too much may carry over conflicts, while preserving too little requires more post-upgrade setup. Balance based on your needs!