Recently I installed Docker CE on my Oracle Linux.
Unfortunately, when I want to start my first container with:
docker run hello-world
I was also facing the same issue while trying to run docker inside lxd (linux container). I tried following flag while creating container.
security.nesting=true
Example: lxc launch ubuntu:x docker -c security.nesting=true
OP, I just ran into this issue. I am not sure what your OL support level is. But to stay supported, you really don't want to use the container-selinux from another distro. What I found as a work around is to set the following:
sudo semanage permissive -a container_runtime_t
After setting that to permissive running containers worked as expected.
I was also facing the same issue, but I have solve the problem by this way. if you are not the root, close the selinux by this command:
sudo setenforce 0
then docker run ...
Another approach to solve this issue is to run docker with privileged: true. Note that this flag, gives docker containers access to everything the host is doing i.e to all the devices, mounts and networks. So use it with caution.
Another approach is set to set make sure to set "selinux-enabled": true
inside your daemon.json. This will make sure the docker knows that selinux is enabled on your system and uses the correct labels when starting the container. More info
Per the bug that david-maze linked to, updating container-selinux
should fix this for you:
sudo yum install http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.107-1.el7_6.noarch.rpm