This is really just a step-by-step version of what’s available in the July 2015 update doc, which links to Django dumpdata and loaddata.
If you want back up your Crypt server database, this is how you can dump the data out:
to find the name of your docker container, in case you forgot it? Let’s just assume, for the next command, that the container’s name is Crypt.
This gets you to a bash prompt inside the Crypt docker container.
Change to the docker crypt directory.
Dump the data out into a .json file.
Exit out of the docker container bash shell.
Copy the .json file to where you are outside the docker container.
If you want to get back into the docker container to delete the original .json (since there is no docker mv, only docker cp), you can do
rm /home/docker/crypt/db.json
exit
P.S. Thanks to Graham Gilbert for the tip about not needing to chmod the manage.py file.
P.P.S. This data dump method will work regardless of whether you’re using the built-in sqlite3 database or an external postgresql database.
Leave a Reply