Closed metawave closed 5 years ago
Since there are multiple ways on how to implement persistent storage in a container, my guess is it won't be implemented here - it depends on your use case. (Volumes, Volume Containers, Folder Mount, etc.) From my understanding it would be too much to give that full decision tree on how to use docker in a simple flat-file-CMS
Besides, if you want to make changes in a container, rethink: You might make changes in a staging area (maybe with quick and dirty folder mounts ;) and redeploy within seconds. That way the production container stays static. Just my 2ct. And YMMV.
you can do this
mkdir ~/bludit
docker run --name bludit \
-p 8000:80 \
-v ~/bludit:/usr/share/nginx/html/bl-content \
-d bludit/docker:latest
@erdnuesse Sorry, I didn't expressed it very well! I also think that would overwhelm a lot of users. I know more than one way to store state/data, since I'm working with kubernetes/gcloud at work. When it comes to docker, it's always also about the moving and the static bits of an application to dockerize. If you don't know either, you'd have a hard time....
In this case the container needs a "volume" to store it's state, regardless if it's a host-mount, nfs, gcloud-persistent-disk, or whatever. I don't see a possibility to make the container really static, since it is a flatfile cms. I think you'd wind up always with some sort of volume mount or retrieving content from an external system upon start and periodically safe content back to the external system.
so the cms will store it's content in /usr/share/nginx/html/bl-content that was everything I wanted to know, thank you @dignajar ! I think that would be helpful for other users as well. And if they don't want to use a folder/host-mount they can adapt it to all possible systems they can think of.
I don't know if you really understood what I meant, I might have not stated my approach in enough detail. If your deployment follows a stage and a prod environment, you'd have a folder mount for creating your website and do all the editing in the CMS. (maybe CMS is the wrong use case for a container but anyway)* STAGE -> Mount the folder for persisting changes like mentioned PROD -> copy that folder into the container and plainly run it, no writing changes required for PROD.
*If you're really looking for an approach () that fits to the same use case like containers do, you might even ditch flat-file CMS'es but rather go for Static Site Generators like Jekyll or Next. They got rid of the CMS approach and deployment comes actually after the editing.
It would be great if you could provide/document on how to persist content created in a container... a volume or folder would be enough to configure it on docker-compose or kubernetes
one uninformed guess could be to mount the /usr/share/nginx/html/bl-content from a volume...