Moving Docker Containers Around

81 views Asked by At

I would like to use this Docker container:

https://registry.hub.docker.com/u/cptactionhank/atlassian-confluence/dockerfile/

My concern is that if I have to wind up moving this docker container to another machine (or it quits for some reason and needs to be restarted) that all the data (server config and other items stored on the file system) is lost. How do I ensure that this data isn't lost?

Thanks!

1

There are 1 answers

4
larsks On BEST ANSWER

The first rule of Docker containers is don't locate your data inside your application container. Data that needs to persist beyond the lifetime of the container should be stored in a Docker "volume", either mounted from a host directory or from a data-only container.

If you want to be able to start containers on different hosts and still have access to your data, you need to make sure your data is available on those hosts. This problem isn't unique to Docker; it's the same problem you would have if you wanted to scale an application across hosts without using Docker.

Solutions include:

  • A network filesystem like NFS.
  • A cluster fileystem like Gluster.
  • A non-filesystem based data store, like a database, or something like Amazon S3.

This is not necessarily an exhaustive list but hopefully gives you some ideas.