The problem is: When I run docker-compose with the scale flag (for multiple containers) it just creates one container and it has all the ports available in docker-compose.yml
I try to run "docker-compose up" with the scale parameter so I can run three containers with a different exposed port in the host for each one:
docker-compose up --scale minecraft=2
After running that command I receive this error:
Error response from daemon: Ports are not available: listen tcp 0.0.0.0:25566: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.
When I run docker PS I see that only one container is running and its taking all the ports
e87a404ab7d0 itzg/minecraft-server "/start" 17 minutes ago Up 17 minutes (healthy) 0.0.0.0:25565->25565/tcp, 25575/tcp, 0.0.0.0:25566->25565/tcp, 0.0.0.0:25567->25565/tcp, 0.0.0.0:25568->25565/tcp, 0.0.0.0:25569->25565/tcp, 0.0.0.0:25570->25565/tcp docker-minecraft-minecraft-1
I have a docker-compose.yml config file where I have availability for more than one port so I don't know the reason of this behaviour.
...
ports:
- 25565-25570:25565
...