這將涉及到Docker php:5.6-Apache Development Environment missing permissions on volume mount泊塢窗集裝箱從PHP:5.6,Apache作爲根
我已經試過幾乎所有使安裝的卷是可讀的www-data
,我目前的解決方案是試圖通過腳本的文件夾移動應用程序需要/var
,並給予適當的權限以便由www-data
寫入,但這變得難以維護。
給予的事實,這是一個開發環境,我不介意是一個安全漏洞,所以我想運行apache
爲root
,我得到
Error: Apache has not been designed to serve pages while running as root. There are known race conditions that will allow any local user to read any file on the system. If you still desire to serve pages as root then add -DBIG_SECURITY_HOLE to the CFLAGS line in your src/Configuration file and rebuild the server. It is strongly suggested that you instead modify the User directive in your httpd.conf file to list a non-root user.
有沒有簡單的方法,我可以使用做到這一點碼頭圖片php:5.6-apache
?
這是我docker-compose.yml
version: '2'
services:
api:
container_name: api
privileged: true
build:
context: .
dockerfile: apigility/Dockerfile
ports:
- "2020:80"
volumes:
- /ft/code/api:/var/www:rw
這是我Dockerfile
:
FROM php:5.6-apache
USER root
RUN apt-get update \
&& apt-get install -y sudo openjdk-7-jdk \
&& echo "www-data ALL=NOPASSWD: ALL" >> /etc/sudoers
RUN apt-get install -y git zlib1g-dev libmcrypt-dev nano vim --no-install-recommends \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/* \
&& docker-php-ext-install mcrypt zip \
&& curl -sS https://getcomposer.org/installer \
| php -- --install-dir=/usr/local/bin --filename=composer \
&& a2enmod rewrite \
&& sed -i 's!/var/www/html!/var/www/public!g' /etc/apache2/apache2.conf \
&& echo "AllowEncodedSlashes On" >> /etc/apache2/apache2.conf \
&& cp /usr/src/php/php.ini-production /usr/local/etc/php/php.ini \
&& printf '[Date]\ndate.timezone=UTC' > /usr/local/etc/php/conf.d/timezone.ini
WORKDIR /var/www
你能提供您Dockerfile和你嘗試啓動你的容器的方式? – vmonteco