A
A
Aleksey Vakhrameev2021-01-12 18:17:12
Docker
Aleksey Vakhrameev, 2021-01-12 18:17:12

Docker container won't start, port is busy, how to start second mongo?

The second mongi container does not start, it writes the port is busy, although the ips are different
5ffdbcda522f1863024086.png
5ffdbce46fdf8609265844.png

From the console:

Starting els-admin-backend-redis ... 
Starting els-admin-backend-mongo ... error
Starting els-admin-backend-redis ... error
ERROR: for els-admin-backend-mongo  Cannot start service els-admin-backend-mongo: Ports are not available: listen tcp 127.0.0.11:27017: bind: can't assign requested address

ERROR: for els-admin-backend-redis  Cannot start service els-admin-backend-redis: Ports are not available: listen tcp 127.0.0.11:6379: bind: can't assign requested address

ERROR: for els-admin-backend-mongo  Cannot start service els-admin-backend-mongo: Ports are not available: listen tcp 127.0.0.11:27017: bind: can't assign requested address

ERROR: for els-admin-backend-redis  Cannot start service els-admin-backend-redis: Ports are not available: listen tcp 127.0.0.11:6379: bind: can't assign requested address
ERROR: Encountered errors while bringing up the project.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Roo, 2021-01-12
@xez

Hang up the second monga on another port

R
Ruslan, 2021-01-13
@Tiasar

127.0.0.x is localhost aka loopback , so 2 identical ports will not be published. It does not matter in this case the fourth act, it will all be localhost. You either need to publish different ports for different Mongo instances or have different real addresses on the machine, for this you need to have 2 network cards with different real network ip addresses.
Another option is to raise 3 dockers with webui (for example, mongotron.io), deplete all 3 containers with the docker-compose network, then they can work each with their own port on the address allocated by the docker, forward the webui address outside, and manage the mongs through it, then merge the mongs to the cluster and the master to publish the port to the outside.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question