title: docker volumes and apache permissions
body: <p>I'm using docker for serving huge website with php. Issue is that when I'm linking my host volume to container I get permission errors. I know that I could run <code>chmod -R 777 /var/www</code> but isn't it little bit dangerous? </p>
  
  <p>My Dockerfile</p>
  
  <pre><code>FROM php:7.0.3-apache 
  RUN docker-php-ext-install mysqli
  RUN a2enmod rewrite
  RUN a2enmod headers
  RUN docker-php-ext-install pdo_mysql
  RUN apt-get update -y &amp;&amp; apt-get install -y sendmail libpng-dev
  
  RUN apt-get update &amp;&amp; \
      apt-get install -y \
          zlib1g-dev 
  
  RUN apt-get update &amp;&amp; apt-get install -y \
          libfreetype6-dev \
          libjpeg62-turbo-dev \
          libpng-dev \
      &amp;&amp; docker-php-ext-install -j$(nproc) iconv \
      &amp;&amp; docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
      &amp;&amp; docker-php-ext-install -j$(nproc) gd
  
  RUN docker-php-ext-install mbstring
  
  RUN docker-php-ext-install zip
  
  RUN docker-php-ext-install gd
  </code></pre>
  
  <p>My Docker-Compose.yml</p>
  
  <pre><code>version: "2"
  services:
      www:
          build: .
          ports: 
              - "80:80"
          volumes:
              - ./test.com:/var/www/
          links:
              - db
          networks:
              - default
      db:
          image: mysql:5.7
          ports: 
              - "3306:3306"
          environment:
              MYSQL_DATABASE: test
              MYSQL_USER: test
              MYSQL_PASSWORD: test
              MYSQL_ROOT_PASSWORD: test
          volumes:
              - ./mysql:/var/lib/mysql
          networks:
              - default
  </code></pre>
  
  <p>Any ideas how to handle host volume permissions?</p>