I am using multiple Dockerfiles to setup my server infrastructure. One of the Dockerfiles I build is a MongoDB server which will be linked to a running web server application in a later step. Currently, I have the problem when running the MongoDB server I receive following error:
"Error parsing command line: unknown option port 27017"
In my Dockerfile I have:
CMD ["--port 27017", "--dbpath /data/db", "--smallfiles"]
ENTRYPOINT ["/usr/bin/mongod"]
When I use instead of the above commands the following everything works:
CMD /usr/bin/mongod --port 27017 --dbpath /data/db --smallfiles
I prefer the CMD – Array and ENTRYPOINT approach more but cannot figure out why I receive the error.
Best Answer
You need to separate out the arguments in the array like:
See this duplicate answer: https://stackoverflow.com/a/24392379/684908