Open2

docker compose scale 時の bind: address already in use

myabaoumyabaou
〉docker compose up -d --scale phpapache=4 phpapache 
[+] Running 2/0
 ⠿ Container docker-phpapache-4  Running                                                                               0.0s
 ⠿ Container docker-phpapache-6  Running                                                                               0.0s
 ⠋ Container docker-phpapache-3  Starting                                                                              0.0s
 ⠋ Container docker-phpapache-5  Starting                                                                              0.0s
Error response from daemon: Ports are not available: listen tcp 0.0.0.0:8081: bind: address already in use

初回はエラーになるが、、

〉docker compose up -d --scale phpapache=4 phpapache 
[+] Running 4/4
 ⠿ Container docker-phpapache-3  Running                                                                               0.0s
 ⠿ Container docker-phpapache-4  Running                                                                               0.0s
 ⠿ Container docker-phpapache-6  Running                                                                               0.0s
 ⠿ Container docker-phpapache-5  Started                                                                               0.2s

もう一度実行すると成功する。なんぞ??