title: docker-compose permission denied
body: <p>I am getting a permission denied error when trying to start up my containers using docker-compose.</p>
  
  <p>Error:
  PermissionError: [Errno 13] Permission denied: '/var/www/sites/api/var/lib/mysql/mysql'
  [1503] Failed to execute script docker-compose</p>
  
  <p>Dockerfile:</p>
  
  <pre><code>FROM php:7.2-apache 
  COPY httpd.conf /etc/apache2/sites-available/ 
  RUN a2dissite 000-default.conf 
  RUN a2ensite httpd.conf 
  RUN a2enmod rewrite
  RUN mkdir /var/www/sites/api 
  RUN chmod -R 777 /var/www/sites/api
  COPY . /var/www/sites/api 
  RUN apt-get update &amp;&amp; \
     docker-php-ext-install mysqli &amp;&amp; \ apt-get clean &amp;&amp; \ apt-get install
   -y libmagickwand-dev --no-install-recommends &amp;&amp; rm -rf /var/lib/apt/lists/* RUN printf "\n" 
   | pecl install imagick 
  RUN docker-php-ext-enable imagick 
  CMD ["/usr/sbin/apache2ctl", "-D","FOREGROUND"]
  </code></pre>
  
  <p>Docker-compose:</p>
  
  <pre><code>    version: '3'
      services:
       qa_api_test:
        build:
        context: ./
      ports:
       - "80:80"
       db:
        image: mysql:5.7
       volumes:
        - /var/lib/mysql:/var/lib/mysql
       environment:
        - MYSQL_ROOT_PASSWORD=xxxx
       ports:
        - "3306:3306"
  </code></pre>