Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1457523

Summary: docker can not mount /etc/mtab from host due to selinux denial.
Product: Red Hat Enterprise Linux 7 Reporter: Ryan Howe <rhowe>
Component: container-selinuxAssignee: Lokesh Mandvekar <lsm5>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Jenner <mjenner>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.3CC: amurdaca, dwalsh, lsm5
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-10-09 12:46:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ryan Howe 2017-05-31 20:57:22 UTC
Description of problem:
Docker can not mount /etc/mtab from host due to selinux denial. 

   /etc/mtab is a symlink to /proc/self/mounts 

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:

# docker run --rm --privileged -v /etc/mtab:/etc/node-mtab rhel7 echo "hello"

container_linux.go:247: starting container process caused "process_linux.go:359: container init caused \"rootfs_linux.go:54: mounting \\\"/etc/mtab\\\" to rootfs \\\"/var/lib/docker/devicemapper/mnt/853c9ecd325aa048e77336fa31e3352773da519e6bbd6e6d99b4890241dd0687/rootfs\\\" at \\\"/var/lib/docker/devicemapper/mnt/853c9ecd325aa048e77336fa31e3352773da519e6bbd6e6d99b4890241dd0687/rootfs/etc/node-mtab\\\" caused \\\"permission denied\\\"\""
/usr/bin/docker-current: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"process_linux.go:359: container init caused \\\"rootfs_linux.go:54: mounting \\\\\\\"/etc/mtab\\\\\\\" to rootfs \\\\\\\"/var/lib/docker/devicemapper/mnt/853c9ecd325aa048e77336fa31e3352773da519e6bbd6e6d99b4890241dd0687/rootfs\\\\\\\" at \\\\\\\"/var/lib/docker/devicemapper/mnt/853c9ecd325aa048e77336fa31e3352773da519e6bbd6e6d99b4890241dd0687/rootfs/etc/node-mtab\\\\\\\" caused \\\\\\\"permission denied\\\\\\\"\\\"\"\n".


# ausearch -m avc --start recent | audit2why 

type=AVC msg=audit(1495820838.586:378): avc:  denied  { mounton } for  pid=3659 comm="exe" path="/var/lib/docker/devicemapper/mnt/853c9ecd325aa048e77336fa31e3352773da519e6bbd6e6d99b4890241dd0687/rootfs/etc/node-mtab" dev="proc" ino=46861 scontext=system_u:system_r:container_runtime_t:s0 tcontext=system_u:system_r:container_runtime_t:s0 tclass=file

	Was caused by:
		Missing type enforcement (TE) allow rule.

		You can use audit2allow to generate a loadable module to allow this access.


# ausearch -m avc --start recent | audit2allow

#============= container_runtime_t ==============
allow container_runtime_t self:file mounton;

Comment 2 Daniel Walsh 2017-06-01 13:51:59 UTC
There is a fix for this in the container-selinux RHEL-1.12 branch.  Just need to pull a new version for 7.3.6.