title: Docker-compose cannot start mysql, permission denied to /tmp
body: <p>I'm trying to start a docker container from the vanilla <code>mariadb</code> image from docker hub using docker-compose. While everything previously worked, I'm now getting the error message <code>Can't create/write to file '/tmp/ibLTxiq7' (Errcode: 13 "Permission denied")</code>. Here's the full log:</p>
  
  <pre><code>139707238336448 [Note] /usr/sbin/mysqld (mysqld 10.1.14-MariaDB-1~jessie) starting as process 51 ...
  139707238336448 [Note] InnoDB: Using mutexes to ref count buffer pool pages
  139707238336448 [Note] InnoDB: The InnoDB memory heap is disabled
  139707238336448 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
  139707238336448 [Note] InnoDB: Memory barrier is not used
  139707238336448 [Note] InnoDB: Compressed tables use zlib 1.2.8
  139707238336448 [Note] InnoDB: Using Linux native AIO
  139707238336448 [Note] InnoDB: Using SSE crc32 instructions
  139707238336448 [ERROR] mysqld: Can't create/write to file '/tmp/ibLTxiq7' (Errcode: 13 "Permission denied")
  7f10205047c0  InnoDB: Error: unable to create temporary file; errno: 13
  139707238336448 [ERROR] Plugin 'InnoDB' init function returned error.
  139707238336448 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
  139707238336448 [ERROR] Unknown/unsupported storage engine: InnoDB
  139707238336448 [ERROR] Aborting
  </code></pre>
  
  <p>I don't understand, does the <code>/tmp</code> folder in the log refer to the host machine or the container? How would I fix this issue?</p>
  
  <p>The command I'm trying to run (as root user) is <code>docker-compose up db</code>. I've checked that there indeed is space on the disk. My OS Ubuntu 16.04.</p>
  
  <p><strong>Update: My <code>docker-compose.yml-file</code></strong></p>
  
  <pre class="lang-yaml prettyprint-override"><code>https-portal:
    image: steveltn/https-portal
    ports:
      - '80:80'
      - '443:443'
    links:
      - wordpress
    restart: always
    environment:
      DOMAINS: 'domain.com -&gt; http://wordpress'
      STAGE: 'production'
  wordpress:
    image: wordpress
    links:
      - db:mysql
    volumes:
      - ~/wordpress/wp_html:/var/www/html
  db:
    image: mariadb
    environment:
      MYSQL_ROOT_PASSWORD: [---]
  </code></pre>
  
  <p><strong>Update 2:</strong></p>
  
  <p>I seem to have (at least temporarily) solved the problem, rather surprisingly, by adding a volume mount path for the db container:</p>
  
  <pre class="lang-yaml prettyprint-override"><code>db:
    image: mariadb
    volumes:
      - /data/maridb:/var/lib/mysql
  </code></pre>
  
  <p><strong>However</strong> this does not actually affect anything, it just prints a warning that the volume mount <em>is not used</em> (and indeed it isn't) because the container has previously been created with a different volume and the old one is used. <strong>Still</strong>, the original problem disappears. Any thoughts on what causes this behavior?</p>