Persisting data

To persist data, create directories on the local host and map the directory to the corresponding volume.

To persist data, create directories on the local host and map the directory to the corresponding volume using the docker run command with the -v option. For example:

docker run -v local_directory:container_volume
Warning: If the volumes are not mounted from the local host, all data is lost when the container is removed.

DataStax exposes data volumes to preserve data. See volumes and data directories for a list of exposed volumes.

Procedure

  1. Create a directory on the Docker host.
  2. Bind mount the local directory to the configuration file that will be persisted by starting the container with the -v option.
    For example, the following command mounts the opscenter.conf file.
    docker run -e DS_LICENSE=accept \
    -v /dse/data/opscenter:/opt/opscenter/conf/opscenterd.conf \
    --name my-opscenter \
    -d datastax/dse-opscenter

Example

Mounting a DSE configuration volume

Mount the host directory /dse/config to the DSE volume /config to manage configuration files.
docker run -e DS_LICENSE=accept \
--name my-dse \
-v /dse/conf:/config datastax/dse-server \
-d datastax/dse-server

Mounting an OpsCenter configuration volume

Mount the local directory to the exposed volume /var/lib/opscenter by starting the container with the -v option.

docker run -e DS_LICENSE=accept \
-v /dse/data/opscenter:/var/lib/opscenter \
--name my-opscenter \
-d datastax/dse-opscenter