Description of problem: SELinux is preventing docker from 'write' accesses on the file /etc/docker/key.json. ***** Plugin catchall_labels (83.8 confidence) suggests ******************* If you want to allow docker to have write access on the key.json file Then you need to change the label on /etc/docker/key.json Do # semanage fcontext -a -t FILE_TYPE '/etc/docker/key.json' where FILE_TYPE is one of the following: afs_cache_t, cgroup_t, docker_home_t, docker_lock_t, docker_log_t, docker_share_t, docker_tmp_t, docker_tmpfs_t, docker_var_lib_t, docker_var_run_t, initrc_tmp_t, puppet_tmp_t, svirt_sandbox_file_t, sysfs_t, systemd_passwd_var_run_t, unlabeled_t, user_cron_spool_t. Then execute: restorecon -v '/etc/docker/key.json' ***** Plugin catchall (17.1 confidence) suggests ************************** If you believe that docker should be allowed write access on the key.json file by default. Then you should report this as a bug. You can generate a local policy module to allow this access. Do allow this access for now by executing: # grep docker /var/log/audit/audit.log | audit2allow -M mypol # semodule -i mypol.pp Additional Information: Source Context system_u:system_r:docker_t:s0 Target Context system_u:object_r:etc_t:s0 Target Objects /etc/docker/key.json [ file ] Source docker Source Path docker Port <Unknown> Host (removed) Source RPM Packages Target RPM Packages Policy RPM selinux-policy-3.13.1-99.fc22.noarch Selinux Enabled True Policy Type targeted Enforcing Mode Enforcing Host Name (removed) Platform Linux (removed) 3.18.0-1.fc22.x86_64 #1 SMP Tue Dec 9 14:49:38 UTC 2014 x86_64 x86_64 Alert Count 1 First Seen 2014-12-12 02:43:26 MSK Last Seen 2014-12-12 02:43:26 MSK Local ID e797967c-c138-455d-81a0-1ae7f9c4c813 Raw Audit Messages type=AVC msg=audit(1418337806.450:2972): avc: denied { write } for pid=25409 comm="docker" path="/etc/docker/key.json" dev="sda4" ino=1387722 scontext=system_u:system_r:docker_t:s0 tcontext=system_u:object_r:etc_t:s0 tclass=file permissive=1 Hash: docker,docker_t,etc_t,file,write Version-Release number of selected component: selinux-policy-3.13.1-99.fc22.noarch Additional info: reporter: libreport-2.3.0 hashmarkername: setroubleshoot kernel: 3.18.0-1.fc22.x86_64 type: libreport
1572405786e6ff9ba9af5aef6bb5664ef3ba2201 fixes this in git.
commit 1572405786e6ff9ba9af5aef6bb5664ef3ba2201 Author: Dan Walsh <dwalsh> Date: Fri Dec 12 07:58:06 2014 -0500 Docker has a new config/key file it writes to /etc/docker Thank you Dan. Back ported F20,F21.
GOing to need this in RHEL7...
Yes, Rhel7 included.
This still occurs the very first time docker is started (/etc/docker dir has not been created yet). The problem is that a type_transition to allow docker_t to create files and folders with the right label (docker_config_t) under /etc is missing. Adding the following to docker local policy solves the problem: files_etc_filetrans(docker_t, docker_config_t, { dir file }) Tested on f21. Should work on rawhide too.
/etc/docker should be in the docker.spec rpm, it should be owned by it. files_etc_filetrans(docker_t, docker_config_t, dir, "docker") SHould be added but nothing more. This would allow docker to create a docker directory in a directory labeled etc_t. Your version would allow it to create any directory/file in a directory labeled etc_t if the file or directory did not already exist.
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle. Changing version to '22'. More information and reason for this action is here: https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22
selinux-policy-3.13.1-116.fc22 has been submitted as an update for Fedora 22. https://admin.fedoraproject.org/updates/selinux-policy-3.13.1-116.fc22
Package selinux-policy-3.13.1-116.fc22: * should fix your issue, * was pushed to the Fedora 22 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing selinux-policy-3.13.1-116.fc22' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2015-3508/selinux-policy-3.13.1-116.fc22 then log in and leave karma (feedback).
selinux-policy-3.13.1-116.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.