我已经在Windows 7上安装了Docker工具箱。
我有一个apache和php5.6的图像,这里是:
FROM php:5.6.15-apache RUN apt-get update&&& apt-get install -y \ apt-utils vim git php5-mysql php5-memcache php5-memcached php5-intl \ wget 运行apt-get install libapache2-mod-php5 -y -o Dpkg :: Options :: = - force-confdef RUN docker-php-ext-install mbstring RUN docker-php-ext-install pdo pdo_mysql RUN apt-get install libcurl4-gnutls-dev -y RUN docker-php-ext-install curl 运行a2enmod重写 ENV APACHE_RUN_USER myname ENV APACHE_RUN_GROUP www-数据 ENV APACHE_LOG_DIR / var / log / apache2 ENV APACHE_LOCK_DIR / var / lock / apache2 ENV APACHE_PID_FILE /var/run/apache2.pid EXPOSE 80 COPY php.ini /usr/local/etc/php/php.ini COPY apache-config.conf /etc/apache2/sites-enabled/000-default.conf RUN echoServerName 127.0.1.1>> /etc/apache2/apache2.conf这个图像是创建的,当我运行 Docker快速入门终端中的docker图像。
在我的apache-config.conf中,我只有一个微小的虚拟主机访问测试网站,只需一个index.php文件。
然后我尝试在Docker快速入门终端中创建容器:
docker run --name = php5.6_container --rm -v// c / sites:/ var / www / html-p 80:80 -p 8080:8080 php5.6我收到以下错误:
AH00112:警告:DocumentRoot [/ var / www / html / test]不存在 AH00112:警告:DocumentRoot [/ var / www / html / test]不存在 [Tue Dec 08 16:36:37.703143 2015] [mpm_prefork:notice] [pid 1] AH00163:Apache / 2.4.10(Debian)配置 - 恢复正常操作 [Tue Dec 08 16:36:37.703733 2015]核心:通知] [pid 1] AH00094:命令行:' apache2 -D FOREGROUND'似乎我的卷选项不被考虑。没有创建容器。
有没有人知道我可能做错了什么?
解决方案有关Windows和Mac的说明,请参阅 docs.docker/engine/userguide/dockervolumes/#mount-a-host-directory-as-a-data-volume 。特别是:如果您在Mac或Windows上使用Docker Machine,您的Docker守护程序只能对OS X或Windows文件系统进行有限的访问。 Docker Machine尝试自动共享您的/用户(OS X)或C:\Users(Windows)目录。
您将需要将您的网站文件移动到某些地方,例如 c:\Users\sites ,然后使用文档中建议的东西进行安装:
docker run --name = php5.6_container --rm -v/ c / Users / sites:/ var / www / html-p 80: 80 -p 8080:8080 php5.6
I'm trying to setup a dev environment trough a docker container on my windows 7 computer.
I've installed Docker toolbox for windows.
I have an image with apache and php5.6 within, here it is :
FROM php:5.6.15-apache RUN apt-get update && apt-get install -y \ apt-utils vim git php5-mysql php5-memcache php5-memcached php5-intl \ wget RUN apt-get install libapache2-mod-php5 -y -o Dpkg::Options::="--force-confdef" RUN docker-php-ext-install mbstring RUN docker-php-ext-install pdo pdo_mysql RUN apt-get install libcurl4-gnutls-dev -y RUN docker-php-ext-install curl RUN a2enmod rewrite ENV APACHE_RUN_USER myname ENV APACHE_RUN_GROUP www-data ENV APACHE_LOG_DIR /var/log/apache2 ENV APACHE_LOCK_DIR /var/lock/apache2 ENV APACHE_PID_FILE /var/run/apache2.pid EXPOSE 80 COPY php.ini /usr/local/etc/php/php.ini COPY apache-config.conf /etc/apache2/sites-enabled/000-default.conf RUN echo "ServerName 127.0.1.1" >> /etc/apache2/apache2.confThis image is created and I can see it when I run "docker images" in the docker quickstart terminal.
In my apache-config.conf, I just have a tiny virtual host to access a test website with just an index.php file.
Then I try to create the container in the Docker quickstart terminal :
docker run --name=php5.6_container --rm -v "//c/sites:/var/www/html" -p 80:80 -p 8080:8080 php5.6I get the following error :
AH00112: Warning: DocumentRoot [/var/www/html/test] does not exist AH00112: Warning: DocumentRoot [/var/www/html/test] does not exist [Tue Dec 08 16:36:37.703143 2015] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.10 (Debian) configured -- resuming normal operations [Tue Dec 08 16:36:37.703733 2015] [core:notice] [pid 1] AH00094: Command line: ' apache2 -D FOREGROUND'It seems like my volume option is not taken into account. And the container is not created.
Does anyone has an idea of what I could be doing wrong ?
解决方案See the note for Windows and Mac at docs.docker/engine/userguide/dockervolumes/#mount-a-host-directory-as-a-data-volume. Particularly:
If you are using Docker Machine on Mac or Windows, your Docker daemon has only limited access to your OS X or Windows filesystem. Docker Machine tries to auto-share your /Users (OS X) or C:\Users (Windows) directory.
Basically, you will need to move your site files to somewhere such as c:\Users\sites and then mount using something like suggested in documentation:
docker run --name=php5.6_container --rm -v "/c/Users/sites:/var/www/html" -p 80:80 -p 8080:8080 php5.6
更多推荐
Docker:使用Docker工具箱在Windows上共享卷
发布评论