Docker Desktop upgrade breaking tutor dev runserver lms

Hi!

I’ve been doing some plugin/MFE development with tutor using Docker Desktop for Mac, and a recent upgrade from Docker Desktop 4.5 to 4.6 (which includes upgrades of docker and docker-compose) seems like it may have broken tutor dev runserver lms.

❯ tutor dev runserver lms
The lms service will be available at http://local.overhang.io:8000
docker-compose -f /Users/mpwheel/projects/partnerships/.local/tutor/env/local/docker-compose.yml -f /Users/mpwheel/projects/partnerships/.local/tutor/env/dev/docker-compose.yml --project-name partnerships_dev run --rm --service-ports lms
[+] Running 9/0
 ⠿ Container partnerships_dev-smtp-1                       Created                                                                                                                                               0.0s
 ⠿ Container partnerships_dev-redis-permissions-1          Created                                                                                                                                               0.0s
 ⠿ Container partnerships_dev-redis-1                      Created                                                                                                                                               0.0s
 ⠿ Container partnerships_dev-mongodb-permissions-1        Created                                                                                                                                               0.0s
 ⠿ Container partnerships_dev-mongodb-1                    Created                                                                                                                                               0.0s
 ⠿ Container partnerships_dev-mysql-1                      Created                                                                                                                                               0.0s
 ⠿ Container partnerships_dev-elasticsearch-permissions-1  Created                                                                                                                                               0.0s
 ⠿ Container partnerships_dev-lms-permissions-1            Created                                                                                                                                               0.0s
 ⠿ Container partnerships_dev-elasticsearch-1              Created                                                                                                                                               0.0s
[+] Running 10/10
 ⠿ Container partnerships_dev-elasticsearch-permissions-1  Started                                                                                                                                               0.4s
 ⠿ Container partnerships_dev-mongodb-permissions-1        Started                                                                                                                                               0.5s
 ⠿ Container partnerships_dev-mysql-1                      Started                                                                                                                                               0.6s
 ⠿ Container partnerships_dev-lms-permissions-1            Started                                                                                                                                               0.4s
 ⠿ Container partnerships_dev-smtp-1                       Started                                                                                                                                               0.5s
 ⠿ Container partnerships_dev-redis-permissions-1          Started                                                                                                                                               0.4s
 ⠿ Container partnerships_dev-elasticsearch-1              Started                                                                                                                                               0.7s
 ⠿ Container partnerships_dev-redis-1                      Started                                                                                                                                               0.8s
 ⠿ Container partnerships_dev-mongodb-1                    Started                                                                                                                                               0.7s
 ⠿ Container partnerships_dev-lms-1                        Started                                                                                                                                               0.4s
Error response from daemon: driver failed programming external connectivity on endpoint partnerships_dev_lms_run_83f555e97ebd (f300565a822d3f98a39275a6ba2c0480cfc6ecaa6a10ff550929592a3f60a436): Bind for 0.0.0.0:8000 failed: port is already allocated
Error: Command failed with status 1: docker-compose -f /Users/mpwheel/projects/partnerships/.local/tutor/env/local/docker-compose.yml -f /Users/mpwheel/projects/partnerships/.local/tutor/env/dev/docker-compose.yml --project-name partnerships_dev run --rm --service-ports lms

(Note that I am using a custom project name here, but this error occurs regardless.)

What I think may be happening is that the command is starting lms-1, which is occupying port 8000, so when the lms_run container tries to start it is unable to use port 8000.

Using tutor dev runserver lms worked correctly with Docker Desktop v4.5 (which includes docker v20.10.12 and compose v2.2.3). Something about the upgrade to Docker Desktop v4.6 (docker v20.10.13 / compose v2.3.3) seems to have caused it to stop working. I’m not an expert on Docker or containers, but the compose 2.2.3-to-2.3.3 upgrade would be my first guess.

Anyway, I’m curious if anyone else is running into this issue, and if there are any workarounds available (or maybe I am just missing something obvious).

Thanks!

This does not have anything to do with the new Docker version, but it comes from the fact that you (probably) already have a running lms container. You should stop it with tutor dev stop lms.

Hi @regis thanks for the response.

Sorry, my description may have been confusing. I do believe that the port conflict is due to a running lms container, but lms was not running prior to invoking tutor dev runserver lms (in fact no containers were running).

What appears to be occurring is that tutor dev runserver lms is running lms at port 8000 prior to starting lms_run. I’ve been able to reproduce this consistently under Docker Desktop 4.6, and have confirmed that things work as expected under Docker Desktop 4.5.

One possible workaround I have found is to uncheck the “Use Docker Compose V2” checkbox in Docker Desktop general preferences. This uses compose v1.29.2 and allows tutor dev runserver lms to run properly. I’m not sure what other consequences it may bring.

In case anyone else bumps into this, there are a few other workarounds suggested in this related compose bug report that could be worth trying.