为什么 Docker 中的 uWSGI 从 CMD 失败,但 运行 从命令行失败?
Why does uWSGI in Docker fail from CMD but run from command line?
我有以下 Dockerfile:
FROM alpine
RUN apk add uwsgi
CMD ["/usr/sbin/uwsgi", "--socket 127.0.0.1:8000"]
运行 它与 docker run <image name>
一起导致以下错误:
/usr/sbin/uwsgi: unrecognized option: socket 127.0.0.1:8000
getopt_long() error
然而,运行 docker run <image name> /usr/sbin/uwsgi --socket 127.0.0.1:8000
工作正常。根据 the docs,像这样使用 CMD
"does not invoke a command shell. This means that normal shell processing does not " 发生了。”我不确定这是否是罪魁祸首。
如何让 uWSGI 在使用 alpine 版本的同时与 CMD 一起工作?
--socket
和127.0.0.1:8000
是不同的选项。
您必须指定:
CMD ["/usr/sbin/uwsgi", "--socket", "127.0.0.1:8000"]
我有以下 Dockerfile:
FROM alpine
RUN apk add uwsgi
CMD ["/usr/sbin/uwsgi", "--socket 127.0.0.1:8000"]
运行 它与 docker run <image name>
一起导致以下错误:
/usr/sbin/uwsgi: unrecognized option: socket 127.0.0.1:8000
getopt_long() error
然而,运行 docker run <image name> /usr/sbin/uwsgi --socket 127.0.0.1:8000
工作正常。根据 the docs,像这样使用 CMD
"does not invoke a command shell. This means that normal shell processing does not " 发生了。”我不确定这是否是罪魁祸首。
如何让 uWSGI 在使用 alpine 版本的同时与 CMD 一起工作?
--socket
和127.0.0.1:8000
是不同的选项。
您必须指定:
CMD ["/usr/sbin/uwsgi", "--socket", "127.0.0.1:8000"]