Docker container access problem

  docker, question

I started a docker db on the server and put mongodb on it.

Then, an active is started to play nodejs.

The two containers can communicate with each other if they use network, but the problem is that if nodejs directly uses public network ip, it cannot access db, but the local machine has no problem, only it cannot be accessed on the server.

(I don’t want to use alias access, because the public network ip has a domain name tied to it, and another server is a backup server. If mongodb hangs up, I can also access the backup server.)

After finding the answer, ariyun is not allowed to call his own data through load balancing.