I have a very simple 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
works as expected.
sudo docker run server -v /public:/server/public
results in: starting container process caused "exec: \\"-v\\": executable file not found in $PATH".
sudo docker run server -d
results in: starting container process caused "exec: \\"-d\\": executable file not found in $PATH"
sudo docker run server -p 80:80
gives similar error.
You have to pass the options before the image name as follow:
docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
For example:
sudo docker run -v /public:/server/public server
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.