Is it good practice to run stateful applications on Docker? What are the scenarios where Docker best fits in?

Technology CommunityCategory: DockerIs it good practice to run stateful applications on Docker? What are the scenarios where Docker best fits in?
VietMX Staff asked 3 years ago

he problem with statefull docker aplications is that they by default store their state (data) in the containers filesystem. Once you update your software version or want to move to another machine its hard to retrieve the data from there.

What you need to do is bind a volume to the container and store any data in the volume.

if you run your container with: docker run -v hostFolder:/containerfolder any changes to /containerfolder will be persisted on the hostfolder. Something similar can be done with a nfs drive. Then you can run you application on any host machine and the state will be saved in the nfs drive.