Docker-CMD-Befehl für Nginx mit angegebener Konfiguration

Docker-CMD-Befehl für Nginx mit angegebener Konfiguration

Ich habe die folgende CMD in meinem Docker-Befehl:

CMD ["nginx", "-c", "/etc/nginx/nginx.conf" "-g", "daemon off;"]

Aber der Schalter wird nicht betätigt -c.

Wenn ich dies im Container ausführe:

nginx -c /etc/nginx/nginx.conf -g "daemon off;"es funktioniert wie erwartet.

Ist meine Syntax falsch?

Antwort1

Ja, Ihre Syntax ist falsch:

CMD ["nginx", "-c", "/etc/nginx/nginx.conf" "-g", "daemon off;"]

Kein Komma nach „nginx.conf“ vor „-g“ …

verwandte Informationen