# Docker compose does not start container for second environment on host Windows Server 2022

**URL:** <https://forums.mobyproject.org/t/docker-compose-does-not-start-container-for-second-environment-on-host-windows-server-2022/873>\
**Category:** Support\
**Created:** [August 16, 2023, 6:24am UTC](https://forums.mobyproject.org/t/docker-compose-does-not-start-container-for-second-environment-on-host-windows-server-2022/873 "2023-08-16T06:24:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mariotomek](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.mobyproject.org/mariotomek/32/323_2.png) [@mariotomek](https://forums.mobyproject.org/u/mariotomek)\
**Post date:** [August 16, 2023, 6:24am UTC](https://forums.mobyproject.org/t/docker-compose-does-not-start-container-for-second-environment-on-host-windows-server-2022/873/1 "2023-08-16T06:24:52Z")

</div>

Hi, I am having problem with starting container from second compose.yml and moreover only on docker host with OS Windows Server 2022. I posted this issue on [forums.docker.com](https://forums.docker.com/t/docker-compose-does-not-start-container-for-second-environment-on-host-windows-server-2022/137258) where there are additional informations on this issue in the comments. They finally referred me to post the problem here on this forum. So I will describe the situation.

I need two same web applications on diferent URL adresses with own databases. So I have created two compose.yml files (compose-env01.yml and compose-env02.yml) for running two environments (env01 and env02). Each environment include two containers (web and mssql DB).

After build compose-env01.yml and compose-env02.yml are the images for web same for env01 and env02. Also images for mssql are the same for env01 and env02:  
**See Figure 1 below**  
Differents betweens compose-env01.yml and compose-env02.yml are only in using ports, as you can see:

compose-env01.yml:

```auto
version: "3.8"
services:
  web:
    build: ./web-mw
    isolation: 'default'
    hostname: web
    deploy:
      resources:
        limits:
          memory: 8G
    ports:
      - "7001:443"
    environment:
      "#CONFSETTINGS_PORT_MW#": "7001"
      "#CONFSETTINGS_MSSQLSERVERPORT#": "14331"
    depends_on:
      - mssql
  mssql: 
    build: ./database
    isolation: 'default'
    hostname: mssql
    ports:
      - "14011:14331"
    expose:
      - "14331"
    volumes:
      - .\volumes\db:C:\sqlbak
    storage_opt:
      size: '25G'
    environment:
      SA_PASSWORD: "Your_password"
      ACCEPT_EULA: "Y"
      MSSQL_PID: "Developer"
      ChangeMSSQLServerPort: "TRUE"
      MSSQLServerPort: "14331"

```

compose-env02.yml:

```auto
version: "3.8"
services:
  web:
    build: ./web-mw
    isolation: 'default'
    hostname: web
    deploy:
      resources:
        limits:
          memory: 8G
    ports:
      - "7002:443"
    environment:
      "#CONFSETTINGS_PORT_MW#": "7002"
      "#CONFSETTINGS_MSSQLSERVERPORT#": "14332"
    depends_on:
      - mssql
  mssql: 
    build: ./database
    isolation: 'default'
    hostname: mssql
    ports:
      - "14012:14332"
    expose:
      - "14332"
    volumes:
      - .\volumes\db:C:\sqlbak
    storage_opt:
      size: '25G'
    environment:
      SA_PASSWORD: "Your_password"
      ACCEPT_EULA: "Y"
      MSSQL_PID: "Developer"
      ChangeMSSQLServerPort: "TRUE"
      MSSQLServerPort: "14332"

```

When I run containers from env01 using command “docker compose -p env01 -f compose-env01.yml up -d”, both containers start correctly. Then I want to run containers from env02 using “docker compose -p env02 -f compose-env02.yml up -d”. But now will start only container env02-mssql-1 and container env02-web-1 remains in the state Starting:  
**See Figure 2 below**  
**And this is the problem!** This only happens on docker host with OS Windows Server 2022. The same configuration on docker host with OS Windows Server 2019 is OK and all containers from env01 and env02 start correctly.

I was trying run docker compose up also with parameter “–verbose” and with “debug”: true in daemon.json, but it didn’t give me any further information. When starting containers from compose-env02.yml, the container env02-mssql-1 started correctly and the container env02-web-1 didn’t even start to run and no further informations was displayed. So after that I canceled the start of the containers from compose-env02.yml. The state of containers from both environments was now this:  
**See Figure 3 below**

**And now a very interesting information:**  
Now when I shut down the containers from **env01** , the container **env02-web-1** started Immediately automatically after that, as you can see:  
**See Figure 4 below**  
Given that, I think it will be probably some network issue. Interestingly, however, the same configuration works on docker host Windows Server 2019.

Figures:

 ![forum_docker](https://canada1.discourse-cdn.com/flex031/uploads/mobyproject/original/1X/8d9d5cd2a96cfe90203255863017406eb2ed7230.png)

Using versions are:  
Docker host with OS Windows Server 2022  
Docker version 24.0.4, build 3713ee1  
Docker Compose version v2.20.2

So could you please help me anybody with this problem? Or could it be a bug in docker?

---

<div class="post-metadata">

**Author:** ![Liero](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.mobyproject.org/liero/32/332_2.png) [@Liero](https://forums.mobyproject.org/u/Liero)\
**Post date:** [January 15, 2024, 1:03pm UTC](https://forums.mobyproject.org/t/docker-compose-does-not-start-container-for-second-environment-on-host-windows-server-2022/873/2 "2024-01-15T13:03:09Z")

</div>

I too have this problem.  
See also these github issues describing (probably) the same problem:

> <https://github.com/docker/compose/issues/10383>
>
> \### Description
> 
> Previously I had a Windows Server 2019 and I could start hund…reds of containers without any issue. Now I'm trying to renew my environment with a Windows Server 2022 Datacenter.
> 
> I have 3 copies of docker-compose.ymls. Each has a exposed port as follows:
> 
> \`\`\`
> version: '3.8'
> services:
> web:
> image: "mcr.microsoft.com/windows/nanoserver:ltsc2022"
> ports:
> - "4604:80"
> command: "ping 4.2.2.4 -t"
> \`\`\`
> 
> The exposed ports are different on each yml so there is no conflict.
> 
> First container starts, Second container start but when staring the THIRD container, the Host Network Service (HNS) comes up in TaskManager, taking 20-30% of CPU and container stuck on starting and nothing happens after this.
> 
> I tried several scenarios to reach the simplest way to reproduce this error. The key point is exposing ports on containers. Without exposing ports I can start multiple containers.
> 
> !\[Host Network Service (HNS) use CPU.\](https://i.stack.imgur.com/XDyPR.png)
> 
> What is the difference between networking defaults in Windows Server 2019 and 2022?
> 
> Should I start some windows services on 2022?
> 
> \### Steps To Reproduce
> 
> \_No response\_
> 
> \### Compose Version
> 
> \_No response\_
> 
> \### Docker Environment
> 
> \_No response\_
> 
> \### Anything else?
> 
> \_No response\_

> <https://github.com/docker/compose/issues/8978>
>
> I have a docker-compose setup that mostly works, but if I attempt to “up” more t…han one, or sometimes two, compositions, 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
> command: ping -t localhost
> ports:
> - target: 1521
> published: 1941
> \`\`\`
> 
> 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.
> 
> Running these equivalent commands with \`docker run\` (in separate cmd instances) has no issue:
> 
> \`\`\`
> 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
> \`\`\`
> 
> I expect that docker-compose should do the same. Up many compositions with no issue.
> 
> 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
> \`\`\`
> 
> Here is docker info:
> 
> \`\`\`
> Client:
> Context: default
> Debug Mode: false
> Plugins:
> app: Docker App (Docker Inc., v0.9.1-beta3)
> buildx: Build with BuildKit (Docker Inc., v0.6.3-docker)
> compose: Docker Compose (Docker Inc., v2.2.1)
> WARNING: Plugin "C:\\\\Program Files\\\\Docker\\\\cli-plugins\\\\docker-compose\_2.1.1.exe" is not valid: plugin candidate "compose\_2.1.1" did not match "^\[a-z\]\[a-z0-9\]\*$"
> 
> Server:
> Containers: 5
> Running: 1
> Paused: 0
> Stopped: 4
> Images: 34
> Server Version: 20.10.11
> Storage Driver: windowsfilter (windows) lcow (linux)
> Windows:
> LCOW:
> Logging Driver: json-file
> Plugins:
> Volume: local
> Network: ics internal l2bridge l2tunnel nat null overlay private transparent
> Log: awslogs etwlogs fluentd gcplogs gelf json-file local logentries splunk syslog
> Swarm: inactive
> Default Isolation: hyperv
> Kernel Version: 10.0 19043 (19041.1.amd64fre.vb\_release.191206-1406)
> Operating System: Windows 10 Pro Version 2009 (OS Build 19043.1348)
> OSType: windows
> Architecture: x86\_64
> CPUs: 8
> Total Memory: 15.82GiB
> Name: CHL1037R
> ID: GZAY:G5RE:3TEN:TQBV:NLQ3:PBQV:MHTT:27SX:XYQX:7R3T:EQZN:LKQM
> Docker Root Dir: C:\\ProgramData\\docker
> Debug Mode: false
> Registry: https://index.docker.io/v1/
> Labels:
> Experimental: true
> Insecure Registries:
> 127.0.0.0/8
> Live Restore Enabled: false
> Product License: Community Engine
> \`\`\`
> 
> I can’t see any helpful information in the event viewer or panic.log. Here is the output from running up with --verbose:
> 
> \`\`\`
> 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')
> \`\`\`
> 
> Thanks,
> Ben
