Score:0

Mongod won't start on boot when binding docker IP

um flag

my problem is similar as in here:

https://stackoverflow.com/questions/59141447/why-does-the-status-of-mongo-throw-me-code-exited-status-48

The problem is that mongo service won't start on boot if I try to bind the docker IP.

If I run sudo systemctl start mongod manually then it's OK. But after enable-ing the service and rebooting it's not running and from the logs I can see the status was 48.

In my /etc/mongod.conf I am binding these two addresses:

net:
  port: 27017
  bindIp: 127.0.0.1,172.17.0.1

Now the reason I need to bind 172.17.0.1 is that there's an app running in docker that needs to access DB running on this server instance.

If I remove the docker IP and leave localhost only, then mongod is started after reboot without any problem after.

I guess that the problem may be that by the time mongod tries to run, the docker service (it is a service, right?) is not yet fully initialized or something like that.

What is the correct way to cope with the problem?

The server is Ubuntu 20.04.3 LTS running on Azure and I installed mongo like this: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.