rfswift image export
Export containers or images to archives.
rfswift image export saves a container or an image as a compressed tar.gz archive. Use it to back up your work, or to move a lab to another machine.
The most common use backs up a container:
rfswift image export container -c my_sdr_container -o sdr_backup.tar.gzBring an archive back with rfswift image import.
rfswift image export is the v4 spelling. The older rfswift export still works, takes the same flags and prints a notice with the new name. See the command tree.
Synopsis
Export a container:
rfswift image export container -c CONTAINER_NAME -o OUTPUT_FILE.tar.gzExport an image:
rfswift image export image -i IMAGE_NAME -o OUTPUT_FILE.tar.gzOptions
Export container
| Flag | What it does | Required | Example |
|---|---|---|---|
-c, --container STRING |
The container to export | Yes | -c my_container |
-o, --output STRING |
The output file | No | -o backup.tar.gz |
Export image
| Flag | What it does | Required | Example |
|---|---|---|---|
-i, --images STRINGS |
The image or images to export | Yes | -i sdr_full |
-o, --output STRING |
The output file | No | -o backup.tar.gz |
Default file names
Without -o, the file name is generated for you:
- Container export:
{container_name}-{YYYYMMDD}.tar.gz - Image export:
{image_name}_converted.tar.gz, with/and:replaced by_
Examples
Export containers
Export a container to a file:
rfswift image export container -c my_sdr_container -o sdr_backup.tar.gzInclude today’s date in the file name:
rfswift image export container -c client_assessment \
-o client_assessment_$(date +%Y%m%d).tar.gzSave into a specific folder:
rfswift image export container -c important_work \
-o ~/backups/containers/important_work_backup.tar.gzKeep a final backup before you delete a container:
rfswift image export container -c old_container -o archives/old_container_final.tar.gz
rfswift container rm -c old_containerExport images
Export an image to a file:
rfswift image export image -i sdr_full -o sdr_full_image.tar.gzExport an image you built yourself:
rfswift image export image -i my_custom_sdr:v1.0 -o custom_sdr_v1.tar.gzWhat gets exported
Container export
A container export captures the container’s filesystem only. Docker settings such as port bindings and network configuration are not included.
| Content | Included? | Notes |
|---|---|---|
| Container filesystem | Yes | All files and changes |
| Installed packages | Yes | Everything in the container |
| Configuration files | Yes | Including the ones you changed |
| Running processes | No | Only the filesystem |
| Mounted volumes | No | Volume data is not included |
| Container metadata | Limited | Basic information only |
| Network configuration | No | Not preserved |
| Port bindings | No | Not preserved |
Mounted folders are not included
Folders mounted into the container, such as the workspace, stay on your computer and are not in the archive. Back them up separately with your usual file backup tools.
Image export
| Content | Included? | Notes |
|---|---|---|
| Image layers | Yes | All filesystem layers |
| Image metadata | Yes | Tags, labels and so on |
| Build history | Yes | The layer history |
| Configuration | Yes | Default settings |
File sizes
Archives are compressed as tar.gz, usually to about a third of the original size. These are rough examples; your sizes depend on the image and what you added to it. The official toolboxes are larger than these examples: rfswift image remote lists their sizes.
| Container type | Uncompressed | Compressed (tar.gz) | Ratio |
|---|---|---|---|
| Minimal (base only) | 500 MB | 150-200 MB | ~3:1 |
| SDR with tools | 2-3 GB | 700 MB - 1 GB | ~3:1 |
| Full SDR stack | 5-8 GB | 1.5-2.5 GB | ~3:1 |
| With large data | 20+ GB | 5-10 GB | ~2-3:1 |
Make the archive smaller
Clean up inside the container before exporting. Open a shell in it:
rfswift container shell -c my_containerInside the container, remove package caches, temporary files, logs and build tools you no longer need, then leave:
apt-get clean
rm -rf /var/lib/apt/lists/*
rm -rf /tmp/*
rm -rf /root/.cache/*
truncate -s 0 /var/log/*.log
apt-get remove -y build-essential
apt-get autoremove -y
exitThen export as usual:
rfswift image export container -c my_container -o clean_backup.tar.gzKeep regular backups
For work you cannot lose, export on a schedule and keep copies in more than one place: locally, on a NAS and off-site.
Troubleshooting
“No such container/image”
The name does not match a container or image on this computer. List them and check the exact name:
rfswift container last
rfswift image local“Permission denied” when writing the file
You cannot write to the output folder. Check its permissions, or create a folder you own:
ls -ld ~/backups/
mkdir -p ~/backups/containers
chmod 755 ~/backups/containersTo write to a system folder, use sudo:
sudo rfswift image export container -c container -o /backup/file.tar.gz