Docker Community Forums

Share and learn in the Docker community.

Docker Compose Hangs on Startup

Hello. I have a docker-compose setup that mostly works, but if I attempt to “up” more than one (or two, sometimes) the composition, it will hang until I bring one of the others down. I’m running Docker for windows. I’ve distilled the issue down to the presence of a port mapping. Here are the compose files:

version: '3.9'
services:
  db2:
    image: mcr.microsoft.com/windows/servercore:ltsc2019
    entrypoint: ping -t localhost
    ports:
      - target: 1521
        published: 1941

Of course, I copy this file and change the published port for each composition. With the port mapping it hangs, without the port mapping it allows me to up as many as I like. I’ve tried many combinations of modifying the default network and using an external network, but nothing helps.

Here are my docker versions:

Client:
Version: 20.10.10
API version: 1.41
Go version: go1.16.9
Git commit: b485636
Built: Mon Oct 25 07:47:53 2021
OS/Arch: windows/amd64
Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.10
API version: 1.41 (minimum version 1.24)
Go version: go1.16.9
Git commit: e2f740d
Built: Mon Oct 25 07:43:13 2021
OS/Arch: windows/amd64
Experimental: true

I can’t see any helpful information in the event viewer or panic.log, but maybe I’m missing something. Any insight would be appreciated.

Thanks,
Ben

I don’t use Windows containers very often so anything I write is just speculation. Keep that in mind.

Does it work when you start only one, wait some minutes and start another? If it doesn’t matter it could be something Windows specific related to the network caused by either the host or the OS in container. I don’t know if there are any limits how many port you can map in which scenario.

Have you tried it with different Docker images? Is the one in the shared code just an example?

Sorry for the repost. My intention was to post it in the correct topic, not to get more attention. I can’t figure out how to modify or delete this one. It was posted in open source projects accidentally; it should have been posted in Docker for Windows.

No problem. I moved it to “Docker Desktop for Windows”.

1 Like

The issue affects all windows images that I’ve tried, and even if I attempt to bring up other compositions with days between. The issue appears to be with docker-compose because when I use run to accomplish the same thing, it works:

docker run -p 1941:1521 mcr.microsoft.com/windows/servercore:ltsc2019 ping -t localhost
docker run -p 1942:1521 mcr.microsoft.com/windows/servercore:ltsc2019 ping -t localhost
docker run -p 1943:1521 mcr.microsoft.com/windows/servercore:ltsc2019 ping -t localhost
docker run -p 1944:1521 mcr.microsoft.com/windows/servercore:ltsc2019 ping -t localhost

Obviously the above commands in separate cmd instances.

You actually use entrypoint in your Docker Compose file instead of command. I don’t see why it would matter but this is definitely a difference.

Good point. Just to be sure I changed my test compose files to this and tried again.

version: '3.9'
services:
  db2:
    image: mcr.microsoft.com/windows/servercore:ltsc2019
    command: ping -t localhost
    ports:
      - target: 1521
        published: 1941

Same behavior as before, trying to bring up the third one hangs:

C:\>cd \util\Docker\Projects\ComposeTest3

C:\util\Docker\Projects\ComposeTest3>docker-compose up
Creating network "composetest3_default" with the default driver
Creating composetest3_db2_1 ...

I copied your compose file with different ports into two projects and worked on Windows 11 with Docker Compose v2. It took about 50 seconds to start the containers after downloading the image.

Sometimes 2 work, but not 3. I know it’s strange to need to have so many running at once, but that’s a requirement of our application. I can run 2 no problem and I get the hangup on the 3rd. Some other developers on my team can only do 1 before the 2nd hangs, however.

I’ve just discovered the --verbose flag, so here’s the output. At the end of the output is where “docker-compose up” hangs forever:

C:\util\Docker\Projects\ComposeTest3>docker-compose --verbose up
compose.config.config.find: Using configuration files: .\docker-compose.yml
compose.cli.docker_client.get_client: docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
CPython version: 3.9.0
OpenSSL version: OpenSSL 1.1.1g  21 Apr 2020
compose.cli.docker_client.get_client: Docker base_url: http+docker://localnpipe
compose.cli.docker_client.get_client: Docker version: Platform={'Name': 'Docker Engine - Community'}, Components=[{'Name': 'Engine', 'Version': '20.10.10', 'Details': {'ApiVersion': '1.41', 'Arch': 'amd64', 'BuildTime': '2021-10-25T07:43:13.000000000+00:00', 'Experimental': 'true', 'GitCommit': 'e2f740d', 'GoVersion': 'go1.16.9', 'KernelVersion': '10.0 19043 (19041.1.amd64fre.vb_release.191206-1406)', 'MinAPIVersion': '1.24', 'Os': 'windows'}}], Version=20.10.10, ApiVersion=1.41, MinAPIVersion=1.24, GitCommit=e2f740d, GoVersion=go1.16.9, Os=windows, Arch=amd64, KernelVersion=10.0 19043 (19041.1.amd64fre.vb_release.191206-1406), Experimental=True, BuildTime=2021-10-25T07:43:13.000000000+00:00
compose.cli.verbose_proxy.proxy_callable: docker inspect_network <- ('composetest3_default')
compose.cli.verbose_proxy.proxy_callable: docker inspect_network -> {'Attachable': True,
 'ConfigFrom': {'Network': ''},
 'ConfigOnly': False,
 'Containers': {},
 'Created': '2021-11-24T15:45:03.1287704-07:00',
 'Driver': 'nat',
 'EnableIPv6': False,
 'IPAM': {'Config': [{'Gateway': '172.24.48.1', 'Subnet': '172.24.48.0/20'}],
          'Driver': 'windows',
          'Options': None},
...
compose.cli.verbose_proxy.proxy_callable: docker info <- ()
compose.cli.verbose_proxy.proxy_callable: docker info -> {'Architecture': 'x86_64',
 'BridgeNfIp6tables': True,
 'BridgeNfIptables': True,
 'CPUSet': False,
 'CPUShares': False,
 'CgroupDriver': '',
 'ContainerdCommit': {'Expected': '', 'ID': ''},
 'Containers': 10,
 'ContainersPaused': 0,
 'ContainersRunning': 2,
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_network <- ('composetest3_default')
compose.cli.verbose_proxy.proxy_callable: docker inspect_network -> {'Attachable': True,
 'ConfigFrom': {'Network': ''},
 'ConfigOnly': False,
 'Containers': {},
 'Created': '2021-11-24T15:45:03.1287704-07:00',
 'Driver': 'nat',
 'EnableIPv6': False,
 'IPAM': {'Config': [{'Gateway': '172.24.48.1', 'Subnet': '172.24.48.0/20'}],
          'Driver': 'windows',
          'Options': None},
...
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=False, filters={'label': ['com.docker.compose.project=composetest3', 'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=False, filters={'label': ['com.docker.compose.project=composetest3', 'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={'label': ['com.docker.compose.project=composetest3', 'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 1 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- ('048fd89b5dd7cf7cd03a861784e49ef555871a4b4a3c608f3d13d410d534bec9')
1 Like

I get the feeling that very few people are using Docker for Windows containers :frowning:

Is there another way to create the network, perhaps? I did try a few things, but I’m not very knowledgeable here. The only requirement is that a single port be exposed.

It is probably true. Here on the forum at least. Sometimes I need to do the research what Windows containers can do but I never felt it good enough for me. Of cours I don’t develop for Windows so it is not surprising.

Sorry I didn’t respond to your previous posts but couldn’t have told you much. I think you need someone who undersrand how networking works on Windows. It could be some limitation that is randomly reached. If it uses hyperv isolation, you could check the networks on hyperv or look for Windows event logs.

This is useful, thanks. I didn’t know about it. I don’t see anything that helps you, but I like it :slight_smile: I am wondering how old is it.

1 Like

I’ve submitted the issue to the docker-compose github project: Docker-Compose Hangs on Up when using Port Bindings · Issue #8978 · docker/compose (github.com)