मैं कर रहा हूँ शुरू कर दिया पाने के लिए पता करने के लिए गोदी श्रमिक और nginx में डोकर. मैं अपनी खुद की कस्टम स्थिर फ़ाइलों और अपने स्वयं के एनजीआईएनएक्स का उपयोग करना चाहता हूं । कॉन्फ, इसलिए मैंने एक डॉकर फ़ाइल बनाई है:
FROM nginxRUN rm /etc/nginx/nginx.confCOPY /nginx.conf /etc/nginx/nginx.confCOPY / /usr/share/nginx/html# Expose portsEXPOSE 80
और मेरे nginx.conf:
#user nobody;worker_processes auto;#error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;#pid logs/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"' '$server_name to: $upstream_addr: $request'; access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 8080; server_name 127.0.0.1; #charset koi8-r; #access_log logs/host.access.log main; location / { root /usr/share/nginx/html; index index.html index.htm; try_files $uri /index.html; include mime.types; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }}
मैं इसके साथ निर्माण कर रहा हूं:
docker build --no-cache -t nginx-custom .
और इसके साथ चल रहा है:
docker run -d -p 8080:80 --name webserver nginx-custom
लेकिन यह बनाता है, और फिर चलता है, लेकिन अगर मैं जांच करता हूं तो तुरंत रुक जाता है
docker ps -a
मैं देख सकता हूं कि यह 1 सेकंड पहले बाहर निकल गया है । मैंने उपयोग करने की कोशिश की CMD /usr/sbin/nginx -g "daemon off;"
या deamon off;
में nginx conf, या का उपयोग करें CMD ["nginx", "-g", "daemon off;"]
कोई फर्क नहीं पड़ता कि मैं क्या करता हूं, यह रन के ठीक बाद बाहर निकलता है ।