1

I installed docker in ubuntu server as 14.04.02. and there is one of container for svn-server.

I attached to svn-docker-container then synchronized from origin svn-server. (by using svn-sync)

In that case, I am worried that there might be data loss, If host pc is NOT property shutdown. will data loss be happened? (updated a svn repository. but host pc is shutdown. what happens?)

If it happens, What is the best way to prevent Data loss? (for example, connect between host directory and container directory by using -v option)

  • possible duplicate of [How to deal with persistent storage (e.g. databases) in docker](http://stackoverflow.com/questions/18496940/how-to-deal-with-persistent-storage-e-g-databases-in-docker) – booyaa Apr 07 '15 at 08:30
  • At the time I undertook a _train the trainer_ training class; one of the key axioms was then -- There are NO _poor_ questions. Plato and Aristotle are probably _spinning_ in apparent containerised graves at the down-vote herewith-in. The learning model back in times when Greeks didn't need to eject refugee keep their economy afloat; was to consider Learning as something the Student/Learner did. To me the down-vote here is a Very Dubious action. We had containers on Burroughs Large and Medium systems in the late 1980-s, things were _weird_; so to me, this question is 101% correct. – will Apr 06 '16 at 14:18

2 Answers2

0

From what I understand, any data storage that is supposed to persist should be implemented by using volumes. If you write all the data that is supposed to be stored to the volume, then that data will be stored on the hosts file system.

The way I understood your question, you have a svn-server-container and a svn-container and you are worried what happens when the svn-server-container is shutdown abnormally. Therefore I suggest that you at least use volumes for the server, so that the server data is stored on your host even if the server-container is shut down. Even if you just shutdown the server-container with docker stop, the data will not be stored, if you don't use volumes.

Also you probably want to use a volume for the svn-container, so you don't always have to pull the whole svn-directory from the server every time you restart the svn-container.

Of course it might happen that your data DOES get corrupted if the corresponding process is terminated abnormally, because maybe there are still some write operations going on that then get interrupted. But assuming that all the write operations have finished and that SVN itself doesn't mind just getting shut down, then this would probably work fine.

SGer
  • 544
  • 4
  • 18
0

A Docker container is-a run-time instance of a Docker specification. There is (or may-be) a binary image of that specification in the Docker repository -- IF you have 'saved one'

Our Docker container is like a startup or autoexec script for a Specific system and Specific configuration and Specific data (content). That is GREAT for repeated running of static things like small web sites, evaluating a server or software package, repeatable test-runs, etc. (for example).

To me the first use-case (I might) show people is a "test database". Every time you say:

 docker run test-database-server

The / Any application with a connection string pointing to that running Docker image is a database server full of know test data for my app. I can update the data within the container -- These updates will NOT persist once the test-database-server terminates. It is like a database reset. Perfect for testing things.

If I wanted my test-database-server to point at different data contents -- Ergo, I may have two or three different test data-sets -- I can put the data in a different Docker container which I can use from my test-database-server

   docker run test-database-server -volumes-from=test-data-container

And my test-data-container can even point to or use "real" disk on my system via the -volume=... option. So the date for test-data-container can be set-up to be persistent as an actual databases outside the container. As I understand it nothing "inside" a container can persist, it is like pre-initialised RAM. It can change and is reset when the image stops.

links:

miken32
  • 42,008
  • 16
  • 111
  • 154
will
  • 4,799
  • 8
  • 54
  • 90