compose icon indicating copy to clipboard operation
compose copied to clipboard

HNS failed with error on Windows 10

Open khaale opened this issue 10 years ago • 19 comments

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.

khaale avatar Oct 09 '16 20:10 khaale

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.

khaale avatar Oct 09 '16 23:10 khaale

Hi!

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

shin- avatar Oct 10 '16 18:10 shin-

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.

khaale avatar Oct 10 '16 20:10 khaale

@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 avatar Oct 22 '16 07:10 khaale

@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.

brenkehoe avatar Oct 22 '16 09:10 brenkehoe

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.

abergs avatar Jan 24 '17 07:01 abergs

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.

lodrantl avatar Jul 04 '17 23:07 lodrantl

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.

nikoo56 avatar Jul 13 '17 18:07 nikoo56

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

ansariwn avatar Aug 11 '17 15:08 ansariwn

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.

darkshade9 avatar Aug 15 '17 20:08 darkshade9

@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.

mrichman avatar Nov 03 '17 15:11 mrichman

@mrichman Not sure. Try https://github.com/docker/for-win/issues/335

ansariwn avatar Nov 04 '17 02:11 ansariwn

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 avatar Nov 24 '17 07:11 PradeepSubbaiyan

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

cveld avatar Dec 01 '17 09:12 cveld

Run this in Admin powershell:

Stop-Service docker

Get-ContainerNetwork | Remove-ContainerNetwork

Start-Service docker

guidoffm avatar Feb 15 '18 10:02 guidoffm

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 avatar Feb 13 '19 12:02 wadoodrahimi

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

Dinah2Grace avatar Mar 20 '19 15:03 Dinah2Grace

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.

stale[bot] avatar Oct 09 '19 19:10 stale[bot]

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

stale[bot] avatar Oct 16 '19 20:10 stale[bot]