Compose: Docker-compose Problem - HNS failed with error : The parameter is incorrect

Created on 14 Nov 2016  Â·  9Comments  Â·  Source: docker/compose

I am running Docker for Windows, and I am using Windows containers and windowsservercore.

From this article, I see that docker-compose is not fully supported on Windows 10. But I am hoping that, with a few hints here, I can get something working.

I am composing something simple …. Just a Redis container that works fine under Windows 10. However, no matter what I try to compose, I get an error about HNS failing with an incorrect parameter. But there is no information to tell me which param is the bad one.

If you have any hints on what I could do to get over this hump, I would appreciate it. If Windows 10 support is not coming soon, then I might as well change to Windows Server 2016. Thanks.

docker-compose --verbose -f .docker-composeRedis.yml up

compose.config.config.find: Using configuration files: .\.\docker-composeRedis.yml
docker.auth.auth.find_config_file: Trying paths: ['C:\\Users\\madler\\.docker\\config.json', 'C:\\Users\\madler\\.dockercfg']
docker.auth.auth.find_config_file: No config file found
compose.cli.command.get_client: docker-compose version 1.9.0-rc4, build bd5d90b
docker-py version: 1.10.6
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2h  3 May 2016
compose.cli.command.get_client: Docker base_url: http+docker://localnpipe
compose.cli.command.get_client: Docker version: KernelVersion=10.0 14393 (14393.351.amd64fre.rs1_release_inmarket.161014-1755), Os=windows, BuildTime=2016-10-11T02:35:40.337930554+00:00, ApiVersion=1.25, Version=1.12.2-cs2-ws-beta, GitCommit=050b611, Arch=amd64, GoVersion=go1.7.1
compose.cli.verbose_proxy.proxy_callable: docker info <- ()
compose.cli.verbose_proxy.proxy_callable: docker info -> {u'Architecture': u'x86_64',
u'BridgeNfIp6tables': True,
u'BridgeNfIptables': True,
u'CPUSet': False,
u'CPUShares': False,
u'CgroupDriver': u'',
u'ClusterAdvertise': u'',
u'ClusterStore': u'',
u'Containers': 0,
u'ContainersPaused': 0,
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_network <- (u'dockerredis_default')
compose.network.ensure: Creating network "dockerredis_default" with the default driver
compose.cli.verbose_proxy.proxy_callable: docker create_network <- (name=u'dockerredis_default', enable_ipv6=False, ipam=None, labels=None, driver=None, internal=False, options=None)

**ERROR: compose.cli.errors.log_api_error: HNS failed with error : The parameter is incorrect.**

docker-composeRedis.yml

version: '2'
services:
  redis:
    build:
      context: .
      dockerfile: DockerfileRedis
    image: marc-redis

DockerfileRedis

FROM microsoft/windowsservercore

RUN powershell -Command \
       $ErrorActionPreference = 'Stop'; \
       Invoke-WebRequest -Method Get -Uri https://github.com/MSOpenTech/redis/releases/download/win-3.2.100/Redis-x64-3.2.100.zip -OutFile c:\redis.zip ; \
       Expand-Archive -Path c:\redis.zip -DestinationPath c:\redis ; \
       Remove-Item c:\redis.zip -Force

WORKDIR /redis
CMD redis-server.exe --protected-mode no

docker info

Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 1.12.2-cs2-ws-beta
Storage Driver: windowsfilter
Windows:
Logging Driver: json-file
Plugins:
Volume: local
Network: nat null overlay
Swarm: inactive
Security Options:
Kernel Version: 10.0 14393 (14393.351.amd64fre.rs1_release_inmarket.161014-1755)
Operating System: Windows 10 Pro
OSType: windows
Architecture: x86_64
CPUs: 4
Total Memory: 16 GiB
Name: madlerwin10dock
ID: ITFA:6FLB:7B7L:P4XW:E4KE:IILC:YIV5:FYYZ:LWHH:EFWZ:K6ID:EUYA
Docker Root Dir: C:\ProgramData\Docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Insecure Registries:
127.0.0.0/8

grouwindows-client

Most helpful comment

Thanks @friism. This just helped me too but your link was a bit confusing as the latest version of the file is missing the relevant content. Here's a link that's hopefully a bit more future proof:

https://github.com/friism/MusicStore/blob/8ce50e3fb34cbfc73537b9cf995fce3608c007fa/docker-compose.windows.yml#L22

Also, here is the relevant section in case anyone else has trouble finding the info. Just add the following at the end of your docker-compose.yml file:

networks:
  default:
    external:
      name: nat

I'd be interested to find out why that section was removed in the latest version of the file. Did you find some other workaround?

All 9 comments

cc @friism - This is outside my area of expertise.

@magmasystems the networking is still a little finicky, check out this example: https://github.com/friism/MusicStore/blob/master/docker-compose.windows.yml#L21

Thanks for your help. I included the "networking" section as per the example. The compose process went further, but there seems to be a protocol violation in the download of Redis.

RUN powershell -Command      $ErrorActionPreference = 'Stop';        Invoke-WebRequest -Method Get -Uri https://github.com/MSOpenTech/redis/releases/download/win-3.2.100/Redis-x64-3.2.100.zip -OutFile c:\redis.zip ;      Expand-Archive -Path c:\redis.zip -DestinationPath c:\redis ;     Remove-Item c:\redis.zip -Force
---> Running in d173e65fa5cb

Invoke-WebRequest : The server committed a protocol violation.
Section=ResponseStatusLine
At line:1 char:34
 ... e = 'Stop'; Invoke-WebRequest -Method Get -Uri https://github.com/MSO ...
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:Htt
  pWebRequest) [Invoke-WebRequest], WebException
   + FullyQualifiedErrorId: WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

This is probably not related to docker-compose, so I will try to get around this problem another way.

Everything working now. I changed the download and extract lines to this and everything is good. Thanks for your help!

RUN powershell -Command (New-Object System.Net.WebClient).DownloadFile('https://github.com/MSOpenTech/redis/releases/download/win-3.2.100/Redis-x64-3.2.100.zip', 'redis.zip')
RUN powershell Expand-Archive -Path redis.zip -DestinationPath c:\\redis
RUN del /f /q redis.zip

Thanks @friism. This just helped me too but your link was a bit confusing as the latest version of the file is missing the relevant content. Here's a link that's hopefully a bit more future proof:

https://github.com/friism/MusicStore/blob/8ce50e3fb34cbfc73537b9cf995fce3608c007fa/docker-compose.windows.yml#L22

Also, here is the relevant section in case anyone else has trouble finding the info. Just add the following at the end of your docker-compose.yml file:

networks:
  default:
    external:
      name: nat

I'd be interested to find out why that section was removed in the latest version of the file. Did you find some other workaround?

@rmslg yes, overlay networking works on Windows now, so this should work seamlessly without specifying external network

@friism are you able to expand slightly on your comment above about overlay being available on Windows and this working seamlessly. Is this only Windows Server, or Windows 10 too?

I am able to docker-compose up my basic compose file and all works well. When I docker stack deploy the same compose file however the tasks do not start, all with the error "HNS failed with error : The parameter is incorrect." I am running Windows 10 Fall Creators Update and the following is the output from docker --version

Docker version 17.11.0-ce-rc2, build d7062e5

@friism @clawrenceks I'm having the same problem as you. Do you know what other troubleshooting methods could be used?

Having the same problem windows 10 1709 and 1803

------------------------- from docker log --------------------------------
[00:40:56.514][WindowsDaemon ][Info ] debug: (Agent).UpdateTaskStatus [module=node/agent node.id=ew1lttm4u17jp97krhs8ek5yf task.id=8br3cpm6t4rmuxfwfqr4nakhj]
[00:40:56.514][WindowsDaemon ][Info ] debug: state changed [node.id=ew1lttm4u17jp97krhs8ek5yf task.id=8epw7ags9uhcxknp8yzhyl3z1 service.id=jvl103d7g73fnejo8d71vvi6f state.transition=ACCEPTED->PREPARING state.desired=READY module=node/agent/taskmanager]
[00:40:56.514][WindowsDaemon ][Info ] debug: dispatcher committed status update to store [task.id=f9ao75zpgsjkrcnovwp0q0qu9 module=dispatcher node.id=ew1lttm4u17jp97krhs8ek5yf state.transition=ASSIGNED->ACCEPTED method=(
Dispatcher).processUpdates]
[00:40:56.514][WindowsDaemon ][Info ] debug: dispatcher committed status update to store [module=dispatcher node.id=ew1lttm4u17jp97krhs8ek5yf method=(Dispatcher).processUpdates task.id=8epw7ags9uhcxknp8yzhyl3z1 state.transition=ASSIGNED->ACCEPTED]
[00:40:56.528][WindowsDaemon ][Info ] debug: task status reported [module=node/agent node.id=ew1lttm4u17jp97krhs8ek5yf]
[00:40:56.528][WindowsDaemon ][Info ] debug: (
Agent).UpdateTaskStatus [node.id=ew1lttm4u17jp97krhs8ek5yf module=node/agent task.id=s94ub8ydjoquj0lt8karwrp6m]
[00:40:56.528][WindowsDaemon ][Info ] debug: task status reported [module=node/agent node.id=ew1lttm4u17jp97krhs8ek5yf]
[00:40:56.528][WindowsDaemon ][Info ] debug: (Agent).UpdateTaskStatus [module=node/agent node.id=ew1lttm4u17jp97krhs8ek5yf task.id=f9ao75zpgsjkrcnovwp0q0qu9]
[00:40:56.528][WindowsDaemon ][Info ] debug: task status reported [module=node/agent node.id=ew1lttm4u17jp97krhs8ek5yf]
[00:40:56.529][WindowsDaemon ][Info ] debug: (
Agent).UpdateTaskStatus [module=node/agent node.id=ew1lttm4u17jp97krhs8ek5yf task.id=8epw7ags9uhcxknp8yzhyl3z1]
[00:40:56.529][WindowsDaemon ][Info ] debug: task status reported [module=node/agent node.id=ew1lttm4u17jp97krhs8ek5yf]
[00:40:56.529][WindowsDaemon ][Info ] debug: Allocating IPv4 pools for network ingress (9pjbnzl4ugmqbrfdummyecndz)
[00:40:56.529][WindowsDaemon ][Info ] debug: RequestPool(LocalDefault, 10.255.0.0/16, , map[], false)
[00:40:56.529][WindowsDaemon ][Info ] debug: Received set for ordinal 0, start 0, end 0, any false, release false, serial:false curr:0

[00:40:56.529][WindowsDaemon ][Info ] debug: Received set for ordinal 65535, start 0, end 0, any false, release false, serial:false curr:0

[00:40:56.530][WindowsDaemon ][Info ] debug: RequestAddress(LocalDefault/10.255.0.0/16, 10.255.0.1, map[RequestAddressType:com.docker.network.gateway])
[00:40:56.530][WindowsDaemon ][Info ] debug: Received set for ordinal 1, start 0, end 0, any false, release false, serial:false curr:0

[00:40:56.530][WindowsDaemon ][Info ] HNSNetwork Request ={"Name":"9pjbnzl4ugmqbrfdummyecndz","Type":"overlay","Subnets":[{"AddressPrefix":"10.255.0.0/16","GatewayAddress":"10.255.0.1","Policies":[{"Type":"VSID","VSID":4096}]}],"AutomaticDNS":true}
[00:40:56.530][WindowsDaemon ][Info ] debug: [POST]=>[/networks/] Request : {"Name":"9pjbnzl4ugmqbrfdummyecndz","Type":"overlay","Subnets":[{"AddressPrefix":"10.255.0.0/16","GatewayAddress":"10.255.0.1","Policies":[{"Type":"VSID","VSID":4096}]}],"AutomaticDNS":true}
[00:40:56.530][WindowsDaemon ][Info ] debug: Allocating IPv4 pools for network tc1_default (yhtnbrfy1zf10h4rk5kubecw1)
[00:40:56.530][WindowsDaemon ][Info ] debug: RequestPool(LocalDefault, 10.0.0.0/24, , map[], false)
[00:40:56.531][WindowsDaemon ][Info ] debug: Received set for ordinal 0, start 0, end 0, any false, release false, serial:false curr:0

[00:40:56.531][WindowsDaemon ][Info ] debug: Received set for ordinal 255, start 0, end 0, any false, release false, serial:false curr:0

[00:40:56.531][WindowsDaemon ][Info ] debug: RequestAddress(LocalDefault/10.0.0.0/24, 10.0.0.1, map[RequestAddressType:com.docker.network.gateway])
[00:40:56.531][WindowsDaemon ][Info ] debug: Received set for ordinal 1, start 0, end 0, any false, release false, serial:false curr:0

[00:40:56.532][WindowsDaemon ][Info ] HNSNetwork Request ={"Name":"yhtnbrfy1zf10h4rk5kubecw1","Type":"overlay","Subnets":[{"AddressPrefix":"10.0.0.0/24","GatewayAddress":"10.0.0.1","Policies":[{"Type":"VSID","VSID":4098}]}],"AutomaticDNS":true}
[00:40:56.532][WindowsDaemon ][Info ] debug: [POST]=>[/networks/] Request : {"Name":"yhtnbrfy1zf10h4rk5kubecw1","Type":"overlay","Subnets":[{"AddressPrefix":"10.0.0.0/24","GatewayAddress":"10.0.0.1","Policies":[{"Type":"VSID","VSID":4098}]}],"AutomaticDNS":true}
[00:40:56.532][WindowsDaemon ][Info ] debug: releasing IPv4 pools from network ingress (9pjbnzl4ugmqbrfdummyecndz)
[00:40:56.532][WindowsDaemon ][Info ] debug: ReleaseAddress(LocalDefault/10.255.0.0/16, 10.255.0.1)
[00:40:56.532][WindowsDaemon ][Info ] debug: Received set for ordinal 1, start 0, end 0, any false, release true, serial:false curr:0

[00:40:56.533][WindowsDaemon ][Info ] debug: releasing IPv4 pools from network tc1_default (yhtnbrfy1zf10h4rk5kubecw1)
[00:40:56.533][WindowsDaemon ][Info ] debug: ReleasePool(LocalDefault/10.255.0.0/16)
[00:40:56.533][WindowsDaemon ][Info ] debug: ReleaseAddress(LocalDefault/10.0.0.0/24, 10.0.0.1)
[00:40:56.533][WindowsDaemon ][Error ] fatal task error [error=HNS failed with error : An adapter was not found. service.id=z9nt3wigh94knf5u4mqmtqq5v node.id=ew1lttm4u17jp97krhs8ek5yf module=node/agent/taskmanager task.id=s94ub8ydjoquj0lt8karwrp6m]
[00:40:56.533][WindowsDaemon ][Info ] debug: Allocating IPv4 pools for network ingress (9pjbnzl4ugmqbrfdummyecndz)
[00:40:56.533][WindowsDaemon ][Info ] debug: state changed [service.id=z9nt3wigh94knf5u4mqmtqq5v node.id=ew1lttm4u17jp97krhs8ek5yf module=node/agent/taskmanager task.id=s94ub8ydjoquj0lt8karwrp6m state.desired=READY state.transition=PREPARING->REJECTED]
[00:40:56.534][WindowsDaemon ][Info ] debug: Received set for ordinal 1, start 0, end 0, any false, release true, serial:false curr:0

[00:40:56.534][WindowsDaemon ][Info ] debug: RequestPool(LocalDefault, 10.255.0.0/16, , map[], false)
[00:40:56.534][WindowsDaemon ][Info ] debug: ReleasePool(LocalDefault/10.0.0.0/24)
[00:40:56.534][WindowsDaemon ][Error ] fatal task error [error=HNS failed with error : An adapter was not found. module=node/agent/taskmanager node.id=ew1lttm4u17jp97krhs8ek5yf task.id=f9ao75zpgsjkrcnovwp0q0qu9 service.id=jogrgbdfesljbsliroz1y9977]
[00:40:56.535][WindowsDaemon ][Info ] debug: (*Agent).UpdateTaskStatus [node.id=ew1lttm4u17jp97krhs8ek5yf module=node/agent task.id=s94ub8ydjoquj0lt8karwrp6m]
[00:40:56.535][WindowsDaemon ][Info ] debug: Received set for ordinal 0, start 0, end 0, any false, release false, serial:false curr:0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

foxx picture foxx  Â·  3Comments

maltefiala picture maltefiala  Â·  3Comments

saulshanabrook picture saulshanabrook  Â·  3Comments

29e7e280-0d1c-4bba-98fe-f7cd3ca7500a picture 29e7e280-0d1c-4bba-98fe-f7cd3ca7500a  Â·  3Comments

squeaky-pl picture squeaky-pl  Â·  3Comments