Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed during hnsCallRawResponse: hnsCall failed in Win32: An adapter was not found. (0x803b0006) #41094

Open
KhimairaCrypto opened this issue Jun 11, 2020 · 16 comments

Comments

@KhimairaCrypto
Copy link

KhimairaCrypto commented Jun 11, 2020

  • [ x ] I have tried with the latest version of my channel (Stable or Edge)
  • [ x ] I have uploaded Diagnostics
  • Diagnostics ID: A60B047F-98F8-483D-9A5A-006030FCCD02/20200610023046

Expected behavior

Been able to run the service

Actual behavior

The service wont run and the task will send log the following error: failed during hnsCallRawResponse: hnsCall failed in Win32: An adapter was not found. (0x803b0006)

Information

  • Windows Version:10.0.19041 Build 19041
  • Docker Desktop Version: I tried using the 2.3.1.0 (edge) and 2.3.03(stable). Same outcome.
  • Are you running inside a virtualized Windows e.g. on a cloud server or on a mac VM: I am using it on my local PC. Tried turning on/off WSL2 and same results

Steps to reproduce the behavior

  1. ... docker swarm init --advertise-addr 192.168.0.92
  2. ... docker network create -d overlay my-overlay
  3. ... docker run -d -p 8000:80 --name my-running-site mcr.microsoft.com/windows/servercore/iis
    . I am able to have iis running on port 8000 without any issues.
  4. ... docker service create --name web --endpoint-mode dnsrr --publish mode=host,target=8000 --network my-overlay --constraint 'node.labels.os==windows' mcr.microsoft.com/windows/servercore/iis
  5. ... docker service ps web --no-trunc
    wsdxwby7g2va0gvsfo3ghdfen web.1 mcr.microsoft.com/windows/servercore/iis:latest@sha256:efca6c1d6af873ef75997a8331d6b1e0677cab38f14002de9ca820940b75785f roller Ready Rejected 2 seconds ago "failed during hnsCallRawResponse: hnsCall failed in Win32: An adapter was not found. (0x803b0006)" pp6ocb9zmtx5ei3riie8a97s0 \_ web.1 mcr.microsoft.com/windows/servercore/iis:latest@sha256:efca6c1d6af873ef75997a8331d6b1e0677cab38f14002de9ca820940b75785f roller Shutdown Rejected 7 seconds ago "failed during hnsCallRawResponse: hnsCall failed in Win32: An adapter was not found. (0x803b0006)" zp1pnwqwcq1s85enaz4qm7ilt \_ web.1 mcr.microsoft.com/windows/servercore/iis:latest@sha256:efca6c1d6af873ef75997a8331d6b1e0677cab38f14002de9ca820940b75785f roller Shutdown Rejected 12 seconds ago "failed during hnsCallRawResponse: hns

I created an issue with the for-win team, but they send me here. docker/for-win#7155 (comment)

Update
I followed these instructions #39191 and still same issue. I even set my WinNode as a worker and created the container using my linux master node. same result :-/

dockerd is only listening on ports TCP: 53, 2377 and 7946 . What about this UDP port 4789 ?

Annotation 2020-06-11 214735

@thaJeztah
Copy link
Member

Did you recently update Windows? Wondering if there's a relation to #40998

@KhimairaCrypto
Copy link
Author

Using Windows Version:10.0.19041 Build 19041

@daschott
Copy link

This error usually indicates there is already an adapted reserved by an existing vSwitch + HNS network.

You can view existing networks using:
docker network ls
hnsdiag list networks

Then, to remove any old networks:
docker rm <network_name>
hnsdiag delete networks <HNS_ID>

Also, in case the Windows was elected as master, the full init command should be:
docker swarm init --advertise-addr=10.127.132.230 --listen-addr 10.127.132.230:2377

@KhimairaCrypto
Copy link
Author

KhimairaCrypto commented Jun 12, 2020

I previously tried:

1. Restart docker desktop
2. Clean / Purge data
3. Reset to factory default
4. Reinstall the latest edge version

This is what I got by following your instructions (before initializing the swarm):

  1. docker network ls
    Annotation 2020-06-12 130917

  2. hnsdiag list networks
    Annotation 2020-06-12 130917

@daschott Which networks do you want me to remove? All of them? The only one that I created was ExternalSwich, using the Virtual Switch Manager. As far as I know "Default Switch", "nat" were automatically created by Docker. I don't have a clue who created the "none" one.

@daschott
Copy link

Assuming you have only 1 active NIC that can be used, the transparent network is already reserving it. In that case you need to do one of either:

  1. try the swarm setup inside the VM (assuming nested virtualization is acceptable for you perf-wise)
  2. add another network adapter with connectivity to your physical machine
  3. remove the ExternalSwitch from your physical machine, so Docker Swarm can create a new one to use.

Option 3 might be easiest, if you do not need the VM and container running side-by-side simultaneously. If you do need them running side-by-side, you should also be able to connect the VMs over WinNAT.

@KhimairaCrypto
Copy link
Author

KhimairaCrypto commented Jun 17, 2020

@daschott I initialized the swarm inside my Windows 10 Box , and as you suggested (Option 3), I removed the ExternalSwich.

docker swarm init --advertise-addr 172.17.128.1 --listen-addr 172.17.128.1:2377

docker network create -d overlay my-overlay

docker network ls
Annotation 2020-06-17 225151

hnsdiag list networks
Annotation 2020-06-17 225151

After trying to bring the service up, as you can see it is stuck somewhere.
Annotation 2020-06-17 225151

docker service ps web --no-trunc
Annotation 2020-06-17 225151

As you can see, it complaining about my-overlay network. Not sure if I need to pass any additional parameter while I create the network?
starting container failed: failed to create endpoint web.1.nhfp31px04a575rkhy95o8jd8 on network my-overlay: failed during hnsCallRawResponse: hnsCall failed in Win32: The specified port already exists. (0x803b0013)

@daschott
Copy link

daschott commented Jun 17, 2020

This error usually means something has already reserved port 8000. Either another app or an existing container. Host port mode publishing means there can only be one instance of the container running per host.

Can you try removing the old service and recreate either without host mode publishing, or try changing the port?
docker service create --name web --replicas 1 --network my-overlay -p 8080:80 --constraint node.platform.os==windows mcr.microsoft.com/windows/servercore/iis

If host mode publishing is needed, can you try setting replicas to 1 (or if more replicas are needed, more hosts are also needed). If you use default routing mesh publishing instead of host mode you should not face this constraint.

@KhimairaCrypto
Copy link
Author

KhimairaCrypto commented Jun 18, 2020

  1. I removed the original swarm, and service.
  2. I set the swarm to use the Default Switch on both the --advertise-addr and --listen-addr
    Annotation 2020-06-18 220201
    docker swarm init --advertise-addr 172.19.112.1 --listen-addr 172.19.112.1:2377
  3. created a basic service without any reference to my-overlay network
    docker service create -p 8000:80 --name web mcr.microsoft.com/windows/servercore/iis
    I check the process and I seam like the service is running okay, but when I try to access on my browser htttp://172.19.112.1:8000 ISS seam down, I check the logs and I don see any issues.
  4. I stopped the previous service and started a new one. This time I only added the reference to my-overlay network.
    docker service create -p 8000:80 --name web --network my-overlay mcr.microsoft.com/windows/servercore/iis
    The service seams like is running okay, but I experience the same issue as step 3)

UPDATE:
It seams to work if I set **mode=host**
docker service create --publish mode=host,target=80,published=8080 --name web mcr.microsoft.com/windows/servercore/iis

If I add the reference to my-overlay network, it will complain about: port is already allocated. Even if there are not a single container nor a service running or using the port 8080
docker service create --publish mode=host,target=80,published=8080 --network my-overlay --name web mcr.microsoft.com/windows/servercore/iis
Annotation 2020-06-18 233134

@KhimairaCrypto
Copy link
Author

@daschott any idea why this is happenig?

@jairov4
Copy link

jairov4 commented Jun 24, 2020

It is happening to me also,
Showing error: Failed creating ingress network: failed during hnsCallRawResponse: hnsCall failed in Win32: An adapter was not found. (0x803b0006) in Event Viewer.
Im using Windows 10 2004 and Docker 19.03.8
My single node swarm setup was made using:
docker swarm init --advertise-addr 192.168.1.35 --listen-addr 192.168.1.35:2377 which is IP address of the windows adapter.
Im using docker in bare metal windows with Hyper-V enabled. I run other VMs there.
My stack is not even using port mapping.

hnsdiag list networks output:

Network : 0D6A2AA5-2FE0-45D3-BC53-EE424C04C414
    Name             : External
    Type             : Transparent

Network : 2CF4DE17-00F7-4795-A98D-A70ECFB732B9
    Name             : nat
    Type             : nat
    Subnet Address   : 172.27.112.0/20
    Gateway          : 172.27.112.1

Network : C08CB7B8-9B3C-408E-8E30-5E16A3AEB444
    Name             : Default Switch
    Type             : ICS
    Subnet Address   : 172.20.16.0/20
    Gateway          : 172.20.16.1

docker network ls output (my_stack_default is the stack network that Im trying to launch).

NETWORK ID          NAME                  DRIVER              SCOPE
9b067933be64        Default Switch        ics                 local
04fe8f24dc6f        External              transparent         local
xloeayuzo68p        my_stack_default      overlay             swarm
sp3kleieus2c        ingress               overlay             swarm
030d957541f5        nat                   nat                 local
25820020a2aa        none                  null                local

Someone pointed here https://stackoverflow.com/questions/56366762/how-to-fix-docker-error-hnscall-failed-in-win32-an-adapter-was-not-found-when that this error could be happening because docker trying to start compute service for Linux instead of Windows but no clue about how he figured out.

Some help would be appreciated.

@jairov4
Copy link

jairov4 commented Jul 5, 2020

Now tried joining windows worker to a linux manager

Get-EventLog -LogName Application -Newest 100
 1320803 jul. 04 23:39 Information DockerService                   0 PowerEvent handled successfully by the service.
 1320802 jul. 04 23:39 Error       docker                          1 Failed creating ingress network: failed during hnsCallRawResponse: hnsCall failed in Win32: An adapter was not found. (0x803b0006)
 1320801 jul. 04 23:39 Information docker                          2 debug: ReleasePool(LocalDefault/10.0.0.0/24)
 1320800 jul. 04 23:39 Information docker                          2 debug: Released address PoolID:LocalDefault/10.0.0.0/24, Address:10.0.0.1 Sequence:App: ipam/default/data, ID: LocalDefault/10.0.0.0/24, DBIndex: 0x0, Bits: 256, Unselected: 253, Sequence: (0xc00000...
 1320799 jul. 04 23:39 Information docker                          2 debug: ReleaseAddress(LocalDefault/10.0.0.0/24, 10.0.0.1)
 1320798 jul. 04 23:39 Information docker                          2 debug: releasing IPv4 pools from network ingress (ox3mxmvf3ojp5lp5y3zhvz0aa)
 1320797 jul. 04 23:39 Information docker                          2 debug: [POST]=>[/networks/] Request : {"Name":"ox3mxmvf3ojp5lp5y3zhvz0aa","Type":"overlay","Subnets":[{"AddressPrefix":"10.0.0.0/24","GatewayAddress":"10.0.0.1","Policies":[{"Type":"VSID","VSID":409...
 1320796 jul. 04 23:39 Information docker                          1 HNSNetwork Request ={"Name":"ox3mxmvf3ojp5lp5y3zhvz0aa","Type":"overlay","Subnets":[{"AddressPrefix":"10.0.0.0/24","GatewayAddress":"10.0.0.1","Policies":[{"Type":"VSID","VSID":4096}]}],"AutomaticDN...
 1320795 jul. 04 23:39 Information docker                          2 debug: Request address PoolID:10.0.0.0/24 App: ipam/default/data, ID: LocalDefault/10.0.0.0/24, DBIndex: 0x0, Bits: 256, Unselected: 254, Sequence: (0x80000000, 1)->(0x0, 6)->(0x1, 1)->end Curr:0 Se...
 1320794 jul. 04 23:39 Information docker                          2 debug: RequestAddress(LocalDefault/10.0.0.0/24, 10.0.0.1, map[RequestAddressType:com.docker.network.gateway])
 1320793 jul. 04 23:39 Information docker                          2 debug: RequestPool(LocalDefault, 10.0.0.0/24, , map[], false)
 1320792 jul. 04 23:39 Information docker                          2 debug: Allocating IPv4 pools for network ingress (ox3mxmvf3ojp5lp5y3zhvz0aa)

@jairov4
Copy link

jairov4 commented Jul 5, 2020

@daschott I tried in a different windows box without External network switch then the error changes but still similar:

failed during hnsCallRawResponse: hnsCall failed in Win32: The parameter is incorrect. (0x57)

@Zordaxy
Copy link

Zordaxy commented Aug 14, 2020

I had similar issue and "--publish mode=host,target=80,published=4010" worked for me (instead of "-p 4010:80").
Thank you @KhimairaCrypto !

@VuiDJi
Copy link

VuiDJi commented Jun 14, 2021

I had similar "port is already allocated" problem when trying to init docker swarn (specifying even both parameters "advertise-addr" and "listen-addr") and then create network and new service, using publish with host mode:

docker swarm init --advertise-addr IP --listen-addr IP:2377
docker network create -d overlay hello_net
docker service create --name web --endpoint-mode dnsrr --publish mode=host,target=8000 --network hello_net mcr.microsoft.com/dotnet/samples:aspnetapp

But few years ago it was working: https://www.youtube.com/watch?v=ZfMV5JmkWCY

@KhimairaCrypto , did you manage to solve this problem?

@stevensbkang
Copy link

Sharing a solution that I have found. What I have noticed is that when an overlay network is created, the default subnet for that overlay network becomes the cidr that is utilised by the host's subnet. I think this is causing some issues.

So, when you create your overlay network, ensure to specify --subnet switch, that is different to the subnet that is used for your Swarm cluster. For instance, if you have allocated 10.0.0.0/24 for your Swarm nodes, then create an overlay with the following docker network create -d overlay portainer_agent_network --subnet 192.168.0.0/24.

This is not really practical as people may rely on Swarm to allocate subnet ranges for them, but this at least gets the environment up and running.

Wish this helps anyone facing this issue, and hope it can be resolved soon.

@ylhyh
Copy link

ylhyh commented May 7, 2022

Same issue here when creating a service with pulishing a "host" mode port:

"failed to create endpoint game_game-server-gateway.1.t0hsb0sacr9l7875jhd0qf1bw on network game_q1autoops_swarm: failed during hnsCallRawResponse: hnsCall failed in Win32: The specified port already exists. (0x803b0013)"

Windows Version: 10.0.19041.928
Docker Version:

C:\Users\Administrator>docker version
Client: Mirantis Container Runtime
Version:           20.10.7
API version:       1.41
Go version:        go1.13.15
Git commit:        40ef3b6
Built:             08/19/2021 18:54:26
OS/Arch:           windows/amd64
Context:           default
Experimental:      true
Server: Mirantis Container Runtime
Engine: 
Version:          20.10.7
API version:      1.41 (minimum version 1.24)
Go version:       go1.13.15
Git commit:       e1bf5b9c13
Built:            08/19/2021 18:53:20
OS/Arch:          windows/amd64
Experimental:     false 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants