2017-07-19 68 views
1

我有一個非常簡單的dockerfile:dockerfile,如何支持docker運行選項-d,-v和-p?

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給出類似的錯誤。

回答

3

你有映像名稱如下之前經過的選項:

docker run [OPTIONS] IMAGE [COMMAND] [ARG...] 

例如:

sudo docker run -v /public:/server/public server 
+1

聖**,我浪費了太多的時間。 –

+0

@ J.Doe感動男人後悔不值得! –