我在我的Dockerfile中有以下内容:
ENTRYPOINT ["/bin/wait-for", "wordpress:9000", "--"]
CMD nginx -g "daemon off;"
这将导致:
nginx_1 | Attempting...
nginx_1 | Command: /bin/sh -c nginx -g "daemon off;"
nginx_1 | Attempting to execute command:
nginx_1 | /bin/sh -c nginx -g "daemon off;"
ayurved_nginx_1 exited with code 0
我猜问题在于引号......如何使它执行
/bin/wait-for wordpress:9000 -- nginx -g "daemon off;"
?
CMD
的 JSON 格式会怎样呢?CMD ["nginx", "-g", "\"daemon off;\""]
- larsksCMD ["nginx -g 'daemon off;'"]
- Tarun Lalwani/bin/sh -c
。如果没有 shell,那么你的其余 argv 就会像现在一样正确。 - Charles Duffy/bin/sh -c
。 - Chris Stryczynski