Docker启动Nginx的镜像报错?
Dockerfile
FROM centos
MAINTAINER salamander 1906747819@qq.com
RUN yum install -y pcre-devel wget net-tools gcc zlib zlib-devel make openssl-devel
# 添加文件
RUN wget http://nginx.org/download/nginx-1.12.1.tar.gz
RUN tar -zxvf nginx-1.12.1.tar.gz
RUN mkdir -p /usr/local/nginx
RUN cd nginx-1.12.1 && ./configure --prefix=/usr/local/nginx && make && make install
ADD nginx.conf /usr/local/nginx/conf/nginx.conf
# Expose ports
EXPOSE 80
EXPOSE 443
CMD ["/usr/local/nginx/sbin/nginx -g 'daemon off;' "]
nginx.conf
#user nginx;
worker_processes 2;
#pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
#access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
报错信息
/usr/bin/docker-current: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused "exec: \"/usr/local/nginx/sbin/nginx -g 'daemon off;' \": stat /usr/local/nginx/sbin/nginx -g 'daemon off;' : no such file or directory"n".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
直接用nginx官方镜像不好吗
CMD ["/usr/local/nginx/sbin/nginx”,“ -g”, “daemon off”]