Skip to content

Example Docker Volume Usage

Digital Rebar Provision writes content in the Docker Container to the /provision/drp-data directory by default. Most DRP Endpoint provisioning systems will want to have persistent data across the container runtimes. For this, you need to add a Docker Volume. The below example shows you how to use the local Docker host as the backing store for the volume. You can also use any of the container based networked storage solutions to back your volume in.

Note

The install.sh script has options to create/start DRP as a container service. It also will created a backing data store volume by default. This information is for operators who wish to customize their Volume usage scenario.

Solution

Managing Docker volumes with dr-provision service to back the data stores.

  1. Create a volume for the container

    export VOL="drp-data"
    
    # create a Docker volume
    docker volume create $VOL
    
  2. Let's verify that the volume is currently empty

    docker volume inspect $VOL | jq '.[].Mountpoint'
    # outputs:
    # "/docker/volumes/drp-data/_data"
    
    # show the contents of the current (empty) volume
    ls -la $(docker volume inspect $VOL | jq -r '.[].Mountpoint')
    # total 0
    # drwxr-xr-x. 2 root root  40 Aug 21 00:41 .
    # dr-xr-x===. 1 root root 180 Aug 21 00:41 ..
    
  3. Launch DRP, using our newly created volume:

    # now run DRP with our volume mapped to /provision/drp-data:
    docker run --volume $VOL:/provision/drp-data --name drp -itd --net host digitalrebar/provision:stable
    
  4. Verify that DRP extracted the assets on the host in the mounted volume location:

    # when DRP starts up, it extracts and builds the default assets
    # in the writable backing store (directory structure):
    ls $(docker volume inspect drp-data | jq -r '.[].Mountpoint')
    # outputs:
    # digitalrebar  job-logs  plugins  replace  saas-content  secrets  tftpboot  ux
    

Additional Information

Additional resources and information related to this Knowledge Base article.

See Also

Versions

all

Keywords

dr-provision, docker, volume, data, persistent data volume

Revision Information

KB Article     :  kb-00007
initial release:  Wed Jun 10 10:06:50 PDT 2020
updated release:  Wed Jun 10 10:06:50 PDT 2020