mariadb docker container on OS X: can't create database directory
<p>I've trouble with mariadb on OSX, I did same on CentOS and it works fine. So it must be OSX issue:</p>

<pre><code>mariadb:
  image: mariadb:latest
  container_name: mariadb
  ports:
    - "3306:3306"
  restart: always
  environment:
    MYSQL_ROOT_PASSWORD: XXXXXXXX
  volumes:
    - /Users/sandro/Code/mysql:/var/lib/mysql
</code></pre>

<p>logs contain following error:</p>

<pre><code>mkdir: cannot create directory '/var/lib/mysql//mysql': Permission denied
Fatal error Can't create database directory '/var/lib/mysql//mysql'
</code></pre>

<p>if I let it mount inside container like so:</p>

<pre><code>volumes:
        - /var/lib/mysql
</code></pre>

<p>it works but I've persistence issues, once vm is restarted dbs are gone.</p>

<p>I tried to create mysql dir and give it world writable permissions and received following error instead:</p>

<pre><code>2016-05-20 23:43:54 140694234605504 [Note] mysqld (mysqld 10.1.14-MariaDB-1~jessie) starting as process 1 ...
2016-05-20 23:43:54 140694234605504 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
2016-05-20 23:43:54 140694234605504 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2016-05-20 23:43:54 140694234605504 [Note] InnoDB: The InnoDB memory heap is disabled
2016-05-20 23:43:54 140694234605504 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-05-20 23:43:54 140694234605504 [Note] InnoDB: Memory barrier is not used
2016-05-20 23:43:54 140694234605504 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-05-20 23:43:54 140694234605504 [Note] InnoDB: Using Linux native AIO
2016-05-20 23:43:54 140694234605504 [Note] InnoDB: Using SSE crc32 instructions
2016-05-20 23:43:54 140694234605504 [Note] InnoDB: Initializing buffer pool, size = 256.0M
2016-05-20 23:43:54 140694234605504 [Note] InnoDB: Completed initialization of buffer pool
2016-05-20 23:43:54 140694234605504 [ERROR] InnoDB: ./ibdata1 can't be opened in read-write mode
2016-05-20 23:43:54 140694234605504 [ERROR] InnoDB: The system tablespace must be writable!
2016-05-20 23:43:54 140694234605504 [ERROR] Plugin 'InnoDB' init function returned error.
2016-05-20 23:43:54 140694234605504 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2016-05-20 23:43:54 140694234605504 [ERROR] mysqld: File '/var/lib/mysql/aria_log_control' not found (Errcode: 13 "Permission denied")
2016-05-20 23:43:54 140694234605504 [ERROR] mysqld: Got error 'Can't open file' when trying to use aria control file '/var/lib/mysql/aria_log_control'
2016-05-20 23:43:54 140694234605504 [ERROR] Plugin 'Aria' init function returned error.
2016-05-20 23:43:54 140694234605504 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
2016-05-20 23:43:54 140694234605504 [Note] Plugin 'FEEDBACK' is disabled.
2016-05-20 23:43:54 140694234605504 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
2016-05-20 23:43:54 140694234605504 [ERROR] Unknown/unsupported storage engine: InnoDB
2016-05-20 23:43:54 140694234605504 [ERROR] Aborting
</code></pre>