我有一个非常简单的dockerfile:
FROM ubuntu:16.04
ADD node-v6.11.1 /usr/local
RUN ln -s /usr/local/bin/node /usr/local/bin/nodejs
RUN node -v
COPY server /server
RUN cd /server && npm install
EXPOSE 80 443
VOLUME ["/server/public"]
CMD cd /server && node server
sudo docker run server
按预期工作。
sudo docker run server -v /public:/server/public
会产生:starting container process caused "exec: \"-v\": executable file not found in $PATH".
sudo docker run server -d
会导致:
starting container process caused "exec: \"-d\": executable file not found in $PATH"
sudo docker run server -p 80:80
给出了类似的错误。
答案 0 :(得分:3)
您必须在图像名称之前传递选项,如下所示:
docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
例如:
sudo docker run -v /public:/server/public server