Mongodb connection problems encountered in Dockerfile nodejs project

  node.js, question

图片描述

Mongodb is not started. How to write in Dockerfile to start mongodb

DockerfileIt is only used to build a mirror image, and eventually it needs to pass throughdocker runTo start the container, otherwise it will not run automatically.

In addition, look at your screenshot, you also did not putmongodbConnection of container tonode.jsIn the container (I don’t know if you put these two programs in a container inside), I suggest you take a look.docker runhit the target--linkThis parameter is related to the introduction.