Compose: HNS failed with error on Windows 10

Created on 9 Oct 2016  Â·  19Comments  Â·  Source: docker/compose

Hi, I have the following error while trying docker-compose up on Windows 10 (with Russian language pack, don't be afraid of cyrillic symbols). I'm using the latest build of docker-compose:

docker-compose.exe --verbose up
compose.config.config.find: Using configuration files: .\docker-compose.yml
docker.auth.auth.find_config_file: Trying paths: ['C:\Users\Aleksander.docker\config.json', 'C:\Users\Aleksander.dockercfg']
docker.auth.auth.find_config_file: No config file found
compose.cli.command.get_client: docker-compose version 1.9.0dev, build 9248298
docker-py version: 1.10.3
CPython version: 2.7.10
OpenSSL version: OpenSSL 1.0.2a 19 Mar 2015
compose.cli.command.get_client: Docker base_url: http://127.0.0.1:2375
compose.cli.command.get_client: Docker version: KernelVersion=10.0 14393 (14393.206.amd64fre.rs1_release.160915-0644), Os=windows, BuildTime=2016-09-23T20:50:29.300867400+00:00, ApiVersion=1.25, Version=1.12.2-cs2-ws-beta-rc1, GitCommit=62d9ff9, 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': 34,
u'ContainersPaused': 0,
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_network <- (u'docker_default')
compose.network.ensure: Creating network "docker_default" with the default driver
compose.cli.verbose_proxy.proxy_callable: docker create_network <- (ipam=None, internal=False, driver=None, options=None, name=u'docker_default')
ERROR: compose.cli.errors.log_api_error: HNS failed with error : Параметр задан неверно.

The _Параметр задан неверно_ means _Parameter is set incorrectly_.

grouwindows-server stale

Most helpful comment

Run this in Admin powershell:

Stop-Service docker

Get-ContainerNetwork | Remove-ContainerNetwork

Start-Service docker

All 19 comments

It seems like the issue is caused by some WinNAT limitations, see https://github.com/docker/docker/issues/23314.

I found some possible workarounds:

  • run get-containernetwork | remove-containernetwork to drop existing docker nat, so that compose will be able to create a new network.
  • specify external network in a docker-compose.yml

Unfortunately, both options causes network issues inside of container.

Hi!

Correct me if I am wrong, but I believe that is a duplicate of #3252 ?

Hi!

Sorry, I've missed that issues, it looks very close.

However, as far as I understood, https://github.com/docker/compose/issues/3252 is (or will be) fixed on Windows Server 2016, so I am just concerned with the fix for Windows 10.

@brenkehoe, it works fine with external network = nat. See https://blog.docker.com/2016/09/build-your-first-docker-windows-server-container/ for example (I checked it and it worked fine on my Win10 environment).

@khaale as soon as I add a static IP to any container I get the error. Best I seem to be able to do is external nat on a subnet of the main one without static ips. But in this instance, the containers don't appear able to communicate with each other unless I am doing something wrong.

Is there any new regarding this? I'm desperately trying to start a number of services using docker-compose and running external network = "nat" makes it hard/Impossible to assign a known IP to a container and it also seems to break the internal network between the containers.

I am also still getting this error running Windows 2016 and latest docker-compose 1.14.0.

Creating network "myapp_default" with the default driver ERROR: HNS failed with error : The parameter is incorrect.

This is the simplest compose file I could imagine:

version: "3.2"

services:
  backend:
    restart: always
    image: myapp/backend
    ports:
     - 8081:8080
  gui:
    restart: always
    image: myapp/gui
    ports:
     - 8082:8080

Setting an external nat network solves the problem, but is not a really pretty fix. Is there something I am missing? Examples say this should work now.

Any update on this issue? I am getting this error when I try to run musicstore sample as docker-compose -f .\docker-compose.windows.yml up or even inside VS.

Any update on this issue? I am getting this issue on Windows Server 2016. Adding the following to the compose file fixes the issue but need to know why is this happening.

networks:
  default:
    external:
      name: nat

This happens to me occasionally and then clears itself up if I try again, seems to be a transient issue at least for us. Causing many headaches with VSTS...

`
Client:
Version: 17.03.1-ee-3
API version: 1.27
Go version: go1.7.5
Git commit: 3fcee33
Built: Thu Mar 30 19:31:22 2017
OS/Arch: windows/amd64

Server:
Version: 17.03.1-ee-3
API version: 1.27 (minimum version 1.24)
Go version: go1.7.5
Git commit: 3fcee33
Built: Thu Mar 30 19:31:22 2017
OS/Arch: windows/amd64
Experimental: false
`

2017-08-15T17:41:43.8513005Z ##[error]C:\Program Files\Docker\docker.exe: Error response from daemon: failed to create endpoint confident_mclean on network nat: HNS failed with error : Unspecified error.

@ansariwn I am trying something similar, and getting this error:

ERROR: for studentwebclient  Cannot start service studentwebclient: failed to create endpoint docker_studentwebclient_1 on network nat: HNS failed with error : The object already exists.

Hi when I type Get-ContainerNetwork in powershell, I am getting the following issue,
PS C:\Users\Pradeep> Get-ContainerNetwork
Get-ContainerNetwork : The term 'Get-ContainerNetwork' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At line:1 char:1

  • Get-ContainerNetwork
  • ~~~~

    • CategoryInfo : ObjectNotFound: (Get-ContainerNetwork:String) [], CommandNotFoundException

    • FullyQualifiedErrorId : CommandNotFoundException

I also tried with lower case as well get-containernetwork. The issue is same. Kindly help me on this issue,

@PradeepSubbaiyan
The PowerShell cmdlets have been deprecated:
https://msdn.microsoft.com/en-us/virtualization/windowscontainers/management/docker-powershell

Run this in Admin powershell:

Stop-Service docker

Get-ContainerNetwork | Remove-ContainerNetwork

Start-Service docker

Hello evryone,

I ran docker CE version 18.09.1 stable on Window 10 pro version 1809 and I activated the Swarm mode. I can create service but I can not connect to Overlay Network.

docker service create -d --name web --endpoint-mode dnsrr --publish mode=host,target=80,published=80 microsoft/iis

it works!

but if I try to connect to an Overlay Network it fails

docker service create -d --name web --endpoint-mode dnsrr --publish mode=host,target=80,published=80 --network my-net microsoft/iis

The error is: Hns failed with error : an adapter was not found

Here are the Networks:

NETWORK ID NAME DRIVER SCOPE

d1d1547a5d5e Standardswitch ics local

b3ad81976542 host transparent local

b5i0zkys9nsj ingress overlay swarm

5d0212aab409 nat nat local

ydkbf4vfnkqh my-net overlay swarm

039bdb7cc276 none null local

@wadoodrahimi did you finally get any solution to this, facing the same issue

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically closed because it had not recent activity during the stale period.

Was this page helpful?
0 / 5 - 0 ratings