Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Docker cannot write to mounted volume

So you've already investigated the permissions, and the selinux context. There are no errors in the audit logs. And if you're using a directory like /var/lib/docker/db, it will have context unconfined_u:object_r:container_var_lib_t:s0. For mounting with -v /var/lib/docker/db/appname:/opt/application/ and it to be readable, you will need a new context.

semanage fcontext -a -t svirt_sandbox_file_t '/var/lib/docker/db(/.*)?'

Comments