Docker how to run mongodb in dockerfile
So far in my dockerfile I have this:
It runs the build and fails as expected because the integration tests require that the mongodb server on the localhost is running.
My question is, what do I write in the dockerfile to create an image that has mongodb, start it before the integration tests, and stop the mongodb server after the integration tests?
One Solution collect form web for “Docker how to run mongodb in dockerfile”
You could run in addition to the other statements in your
Dockerfile statements to install mongodb.
As a template you could for instance use the instructions from the tutum/mongodb
Then instead of using the
mvn command directly you could call a shell script instead in which you start mongodb first, then execute
mvn and as a last step stop mongodb.