我有一个docker镜像设置,可以在Ubuntu图像上运行NGINX,这是一个容器。在运行时期间,我想在启动Docker镜像时按如下方式挂载目录
docker run -v C:/Docker/webroot:/var/www/html -p 8080:80 --name default nginx_image
但是,当我查看日志时,上面的命令会给我以下错误
[20:18:03.853] [ApiProxy] [Info]重写了挂载C:/ Docker / webroot:/ var / www / html(volumeDriver =)到/ C / Docker / webroot:/ var / www / html < / p>
[20:18:03.870] [ApiProxy] [信息]无法走到[快照c99a6d868eda009bf52542988015ef5676b2015b ro com.docker.driver.amd64-linux proxy http] 9p:没有这样的文件或目录
我尝试了不同的写窗口路径的方法,但它没有帮助。我还通过登录检查了Docker图像/ var / www / html目录在那里创建。
其他信息:
构建映像时,我的Dockerfile如下所示:
#Download base image ubuntu 16.04
FROM ubuntu:16.04
# Update Software repository
RUN apt-get update
# Install nginx, php-fpm and supervisord from ubuntu repository
RUN apt-get install -y nginx php7.0-fpm supervisor && \
rm -rf /var/lib/apt/lists/*
#Define the ENV variable
ENV nginx_vhost /etc/nginx/sites-available/default
ENV php_conf /etc/php/7.0/fpm/php.ini
ENV nginx_conf /etc/nginx/nginx.conf
ENV supervisor_conf /etc/supervisor/supervisord.conf
# Enable php-fpm on nginx virtualhost configuration
COPY default ${nginx_vhost}
RUN sed -i -e 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' ${php_conf} && \
echo "\ndaemon off;" >> ${nginx_conf}
#Copy supervisor configuration
COPY supervisord.conf ${supervisor_conf}
RUN mkdir -p /var/www/html && \
mkdir -p /run/php && \
chown -R www-data:www-data /var/www/html && \
chown -R www-data:www-data /run/php
# Volume configuration
VOLUME ["/etc/nginx/sites-enabled", "/etc/nginx/certs", "/etc/nginx/conf.d", "/var/log/nginx", "/var/www/html"]
# Configure Services and Port
COPY start.sh /start.sh
CMD ["./start.sh"]
EXPOSE 80 443