How to build stateful docker services architecture with CoreOS's fleet? -
coreos used fleet enables 1 build services running docker applications.
but there way run docker services require state kept between restarts, persistent? instance, databases or services must store files shared later on.
because far know, service can launched on core-1
machine (for example), , on restart launched on 1 randomly. docker volume can lost.
the simplest way maintain database service schedule fleet unit same machine. can adding [x-fleet]
section fleet unit file , either assigning unit particular x-conditionmachineid
, or x-conditionmachinemetadata
. see coreos documentation.
you can persist data outside docker containers mounting volume host machine. recommended way of doing wrap data in separate data container via docker:
docker run --name mongodb-volume -v /home/core/mongodb-data:/data/db busybox docker run -p 27017 --volumes-from mongodb-volume mongodb:latest
since /home/core/mongodb-data
on particular machine store persistent mongodb state , unit scheduled same machine, solve problem.
Comments
Post a Comment