Docker和symfony
我正在与Docker苦苦挣扎。
我正努力创造一个图像来处理symfony项目,并在同一时间学习Docker。 这是我的Dockerfile:
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 \ && apt-get clean # 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
我使用以下命令构build映像:
docker build -t symfony .
效果很好! 凉!
我创build了一个容器:
docker run --name symfony -d -v "$PWD":/var/www/html -p 80:80 symfony
也适用。 Web服务器正在良好的端口上运行。
我可以在我的容器中
docker exec -ti symfony bash
但是当我试图做一个composer php更新,我有一些错误:
Failed to download symfony/symfony from dist: Could not decompress the archive, enable the PHP zip extension. A php.ini file does not exist. You will have to create one.
如何在Dockerfile中创buildphp.ini?
我也认为我有一个权限问题。 当我尝试到web / app_dev.php时,我有这个消息:
You are not allowed to access this file. Check app_dev.php for more information.
您可以添加一个自定义的php.ini
configuration,在dockerfile中指定它,例如,你可以看看这个例子的回购 :
dokerfile
# install a few more PHP extensions RUN apt-get update && apt-get install -y php5-imagick php5-gd php5-mongo php5-curl php5-mcrypt php5-intl # copy a custom config file from the directory where this Dockerfile resides to the image COPY php.ini /etc/php5/fpm/php.ini
你可以在网上find各种方法和各种样本。
希望这个帮助