Container can't write data in overlays

Hi,

First :
Issue type: File access
OS Version/build: CentOS Linux release 7.5.1804 . VM on a xenserver 6.2
App version: docker-ce-18.06.0.ce-3.el7.x86_64
Steps to reproduce:

The docker logs shows that the mysql initdb fails.
If you run a container from the mariadb image, you will see that:

  • the initdb directoy is not mounted in the container
  • the mysql.sockd is not created or you can’t access it

If I look at the selinux “tags” on the overylays, I see that is not the right one.

  • ls -ldZ /var/lib/docker/overlay/8acbd8497a2bf98cdd53f515ec059e0e4f1ef2be99161d04f583681790f374d4/upper/run
  • drwxr-xr-x. root root system_u:object_r:container_share_t:s0

Should be:

  • system_u:object_r:container_file_t:s0:cxxx,cyyy

I know that because the same installation/configuration (done with asible) on a physical server is working well !

Any idea ?