Unable to Mount tmpfs Filesystem as Root in Container Environment

Issue Description When attempting to mount a tmpfs filesystem to the directory ./mem_disk as the root user inside a container, the operation fails with a "permission denied" error.
Command Executed:
mount -t tmpfs -o size=100G tmpfs ./mem_disk
mount -t tmpfs -o size=100G tmpfs ./mem_disk

Error Output:
mount: /workspace/akide/code/UniWorld-V1/mem_disk: permission denied.
mount: /workspace/akide/code/UniWorld-V1/mem_disk: permission denied.

Troubleshooting Steps Already Taken 1. Verified User Permissions: Confirmed the operation is run as root (no need for sudo).
2. Checked Mount Point:
- Created ./mem_disk directory (via mkdir -p ./mem_disk).
- Set ownership to root:root and permissions to 755 (via chown root:root ./mem_disk and chmod 755 ./mem_disk).
- Checked for special attributes (e.g., immutable flag) with lsattr; none were found.
3. Simplified Mount Command: Tested without size=100G (e.g., mount -t tmpfs tmpfs ./mem_disk), but the same error occurred.
4. Checked Kernel Support: On the host, grep TMPFS /boot/config-$(uname -r) returned CONFIG_TMPFS=y, confirming tmpfs is supported.
Suspected Cause The container environment likely restricts mount operations via security policies (e.g., lack of --privileged mode in Docker). Containerized root users do not have full host root privileges by default, and mount requires CAP_SYS_ADMIN capabilities, which may be blocked.
Request Please assist with:
1. Confirming if the container is running with sufficient privileges to allow tmpfs mounting.
2. Providing steps to enable mount permissions (e.g., adjusting Docker run flags or container security settings).
3. Alternatives if tmpfs mounting is restricted (e.g., using host-mounted tmpfs or alternative in-memory storage).
Additional Context:
- Container ID: f695a62601b9
1 Reply
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?