I’ve now had chance to test the ‘round trip’ of exporting a Category from one Discourse instance and importing it into a different one. Using @zogstrip’s advice above this worked perfectly.
##on the ‘source’ instance:
cd /var/discourse
launcher enter app
discourse export_category [category_number]
transferring the .json file
I transferred the file from the ‘source’ to ‘destination’ instance using a 2-step process:
- SFTP from inside the Docker container to the ‘destination’ server and copy the export file to somewhere on the ‘destination’ server filesystem (but remember that this is outside the Docker container)
- Copy this file into the Docker container with
sudo cp path-file-host /var/lib/docker/aufs/mnt/FULL_CONTAINER_ID/PATH-NEW-FILE(get container ID fromdocker psfrom where you get the short CID, thendocker inspect -f '{{.Id}}' [short CID]which returns the long CID. Thanks to this thread for the help with that.
I know that Docker 1.8 lets you use docker cp but I’m currently on Docker 1.7 and didn’t want to break anything by upgrading right when I need everything to work!
For my own education, I’d be really interested to hear if there is a more elegant or even single-step way of transferring the .json file across from the Docker Container in ‘source’ to inside the Docker Container in ‘destination’.
#on the ‘destination’ machine:
cd /var/discourse
./launcher enter app
cd [to wherever you put the .json file in your destination's Docker container]
discourse import_category [json file]
Marcus