Enabling Docker Access to Storage

Changing Context

When SELinux is used, you must perform the following volume provisioning steps on each of the nodes labeled as supporting database storage:

export DIRPATH=/<storage_dir>
sudo mkdir -p $DIRPATH
sudo chcon -t svirt_sandbox_file_t "${DIRPATH}"

Setting Permission for Local Storage

When either using CNS or DAS, it is necessary to set permission for local storage; for example, if the host is running as user centos with a user ID of 1000

centos:x:1000:1000:Cloud User:/home/centos:/bin/bash

Because we are running the container as uid 1000 the UIDs match up.

To permit the container access to the mapped host volume to centos, execute the following command:

chown centos:0 /mnt/local-storage/<path>