Resolution error in Docker container for Symfony2

I am trying to create a Docker image to load a Symfony project. Here is my Docker file:

FROM php:7-apache

LABEL Description = "This image is used to start Symfony3 project"

ENV DIRPATH /var/www/html

# apt-get command
RUN apt-get update && apt-get install -y \
    vim \
    git
RUN apt-get install -y zlib1g-dev && docker-php-ext-install zip


# Install Composer
RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer

# Install the Symfony Installer
RUN curl -LsS http://symfony.com/installer -o /usr/local/bin/symfony
RUN chmod a+x /usr/local/bin/symfony

# Create the php.ini file
RUN cp /usr/src/php/php.ini-development /usr/local/etc/php/php.ini

Building an assembly and creating a container work well, but I have a resolution problem in my container. When I go to app_dev.php , I have this message:

You are not allowed access to this file. Check app_dev.php for more information.

Apparently, I can only access this file using localhost. Also, PHP cannot delete or create anything in my container. For example, I have the following error at startup:

$php app/console cache:clear
Failed to remove directory "/var/www/html/app/cache/dev_old/doctrine

How can I solve this in my Docker file?

+4
1

:

Dockerfile. .

# Workaround for write permission on write to MacOS X volumes
# See https://github.com/boot2docker/boot2docker/pull/534
RUN usermod -u 1000 www-data
+5

Source: https://habr.com/ru/post/1618565/


All Articles