我是 Docker 新手,我正在尝试简单地启动一个 nginx 应用程序。
为此,我有这个 DockerFile:
FROM debian:wheezy
MAINTAINER John Regan <john@jrjrtech.com>
RUN echo "deb http://nginx.org/packages/debian/ wheezy nginx" >> /etc/apt/sources.list.d/nginx.list
RUN apt-key adv --fetch-keys "http://nginx.org/keys/nginx_signing.key"
RUN apt-get update && apt-get -y dist-upgrade
RUN apt-get -y install nginx openssl ca-certificates
##Delete default repository
RUN rm -rf /etc/nginx/conf.d/*
RUN rm -rf /srv/www/*
ADD conf/nginx.conf /etc/nginx/nginx.conf
ADD conf/conf.d/default.conf /etc/nginx/conf.d/default.conf
ADD html/index.html /srv/www/index.html
VOLUME ["/etc/nginx"]
VOLUME ["/srv/www"]
EXPOSE 80
EXPOSE 443
ENTRYPOINT ["nginx"]
CMD []
我的文件夹是这样组织的:
├── conf
| ├── nginx.conf
| └── conf.d
| └── default.conf
├── html
| └── index.html
启动容器的命令:
sudo docker run -d -p 80:80 -v $pwd/conf:/etc/nginx -v $pwd/html:/srv/www my-nginx
但是容器停止了,我在日志中收到了这条消息:
nginx: [emerg] open() "/etc/nginx/mime.types" failed (2: No such file or directory) in /etc/nginx/nginx.conf:14
我知道日志很清楚,但我不知道为什么它不起作用。
谢谢。