# Docker Compose Hangs on Startup

**URL:** <https://forums.docker.com/t/docker-compose-hangs-on-startup/117871>\
**Category:** Docker Desktop\
**Tags:** docker, docker-compose, windows\
**Created:** [November 21, 2021, 5:18am UTC](https://forums.docker.com/t/docker-compose-hangs-on-startup/117871 "2021-11-21T05:18:03Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaboomer13](https://avatars.discourse-cdn.com/v4/letter/k/898d66/32.png) [@kaboomer13](https://forums.docker.com/u/kaboomer13)\
**Post date:** [November 21, 2021, 5:18am UTC](https://forums.docker.com/t/docker-compose-hangs-on-startup/117871/1 "2021-11-21T05:18:03Z")

</div>

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:

```auto
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

---

<div class="post-metadata">

**Author:** ![rimelek](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rimelek/32/41602_2.png) [@rimelek](https://forums.docker.com/u/rimelek)\
**Post date:** [November 24, 2021, 9:55pm UTC](https://forums.docker.com/t/docker-compose-hangs-on-startup/117871/2 "2021-11-24T21:55:03Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![kaboomer13](https://avatars.discourse-cdn.com/v4/letter/k/898d66/32.png) [@kaboomer13](https://forums.docker.com/u/kaboomer13)\
**Post date:** [November 24, 2021, 10:30pm UTC](https://forums.docker.com/t/docker-compose-hangs-on-startup/117871/3 "2021-11-24T22:30:30Z")

</div>

> [@rimelek](#):
>
> use Windows containers very often so anything I write is just speculation. Keep th

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.

---

<div class="post-metadata">

**Author:** ![rimelek](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rimelek/32/41602_2.png) [@rimelek](https://forums.docker.com/u/rimelek)\
**Post date:** [November 24, 2021, 10:35pm UTC](https://forums.docker.com/t/docker-compose-hangs-on-startup/117871/4 "2021-11-24T22:35:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kaboomer13](https://avatars.discourse-cdn.com/v4/letter/k/898d66/32.png) [@kaboomer13](https://forums.docker.com/u/kaboomer13)\
**Post date:** [November 24, 2021, 10:37pm UTC](https://forums.docker.com/t/docker-compose-hangs-on-startup/117871/5 "2021-11-24T22:37:09Z")

</div>

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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![rimelek](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rimelek/32/41602_2.png) [@rimelek](https://forums.docker.com/u/rimelek)\
**Post date:** [November 24, 2021, 10:41pm UTC](https://forums.docker.com/t/docker-compose-hangs-on-startup/117871/6 "2021-11-24T22:41:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kaboomer13](https://avatars.discourse-cdn.com/v4/letter/k/898d66/32.png) [@kaboomer13](https://forums.docker.com/u/kaboomer13)\
**Post date:** [November 24, 2021, 10:47pm UTC](https://forums.docker.com/t/docker-compose-hangs-on-startup/117871/7 "2021-11-24T22:47:49Z")

</div>

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

```auto
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:

```auto
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 ...

```

---

<div class="post-metadata">

**Author:** ![rimelek](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rimelek/32/41602_2.png) [@rimelek](https://forums.docker.com/u/rimelek)\
**Post date:** [November 24, 2021, 11:39pm UTC](https://forums.docker.com/t/docker-compose-hangs-on-startup/117871/8 "2021-11-24T23:39:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kaboomer13](https://avatars.discourse-cdn.com/v4/letter/k/898d66/32.png) [@kaboomer13](https://forums.docker.com/u/kaboomer13)\
**Post date:** [November 24, 2021, 11:42pm UTC](https://forums.docker.com/t/docker-compose-hangs-on-startup/117871/9 "2021-11-24T23:42:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kaboomer13](https://avatars.discourse-cdn.com/v4/letter/k/898d66/32.png) [@kaboomer13](https://forums.docker.com/u/kaboomer13)\
**Post date:** [November 24, 2021, 11:44pm UTC](https://forums.docker.com/t/docker-compose-hangs-on-startup/117871/10 "2021-11-24T23:44:47Z")

</div>

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:

```auto
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')

```

---

<div class="post-metadata">

**Author:** ![kaboomer13](https://avatars.discourse-cdn.com/v4/letter/k/898d66/32.png) [@kaboomer13](https://forums.docker.com/u/kaboomer13)\
**Post date:** [November 29, 2021, 4:59pm UTC](https://forums.docker.com/t/docker-compose-hangs-on-startup/117871/11 "2021-11-29T16:59:07Z")

</div>

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

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.

---

<div class="post-metadata">

**Author:** ![rimelek](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rimelek/32/41602_2.png) [@rimelek](https://forums.docker.com/u/rimelek)\
**Post date:** [November 29, 2021, 5:21pm UTC](https://forums.docker.com/t/docker-compose-hangs-on-startup/117871/12 "2021-11-29T17:21:06Z")

</div>

> [@kaboomer13](#):
>
> I get the feeling that very few people are using Docker for Windows containers ☹

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.

> [@kaboomer13](#):
>
> I’ve just discovered the --verbose flag

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

---

<div class="post-metadata">

**Author:** ![kaboomer13](https://avatars.discourse-cdn.com/v4/letter/k/898d66/32.png) [@kaboomer13](https://forums.docker.com/u/kaboomer13)\
**Post date:** [November 29, 2021, 7:20pm UTC](https://forums.docker.com/t/docker-compose-hangs-on-startup/117871/13 "2021-11-29T19:20:03Z")

</div>

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)](https://github.com/docker/compose/issues/8978)
