When you start Kiwi TCMS by running
it will automatically create 2 volumes:
This blog post will outline how to backup these docker volumes.
Backing up the database
Kiwi TCMS is a Django application and the
manage.py command provides an easy way
to dump and load the database contents. To export all contents on your docker host
docker exec -it kiwi_web /Kiwi/manage.py dumpdata --all --indent 2 > database.json
This will create a file named
database.json in the current directory, outside of the
You can restore the database contents by using the following commands:
# delete data from all tables docker exec -it kiwi_web /bin/bash -c '/Kiwi/manage.py sqlflush | /Kiwi/manage.py dbshell' # then reload the existing data cat database.json | docker exec -i kiwi_web /Kiwi/manage.py loaddata --format json -
NOTE: depending on your scenario you may want to remove the existing volume
docker-compose down && docker volume rm kiwi_db_data) and re-create the
DB schema (
/Kiwi/manage.py migrate) before restoring the contents!
WARNING: the above steps are applicable to Kiwi TCMS 5.1 or above. On earlier
manage.py will fail due to various issues.
Backing up file uploads
Uploaded files can easily be backed up with:
docker exec -it kiwi_web /bin/tar -cP /var/kiwi/uploads > uploads.tar
and then restored:
cat uploads.tar | docker exec -i kiwi_web /bin/tar -x
You may also try the
rsync command but be aware that it is not installed
The same approach may be used to backup
/var/lib/mysql/ from the
By default both docker volumes created for Kiwi TCMS use the
and are available under
/var/lib/docker/volumes/<volume_name> on the host
running your containers. You can try backing them up from there as well.
Another alternative is to use the
and create these volumes as LVM2 block devices. Then use
lvcreate -s command to create a snapshot volume. For more information see
chapter 2.3.5. Snapshot Volumes
from the LVM Administrator Guide for Red Hat Enterprise Linux 7.