Docker Community Forums

Share and learn in the Docker community.

How to troubleshoot docker on windows : hnsCall failed in Win32: The parameter is incorrect. (0x57)

swarm

(Ognyan Dimitrov) #1

I am posting this after reading whatever was there on docker forums and SO and after tried everything.

What is the proper method of investigating this? What am I missing?

Are there logs that I am missing? I checked C:/ProgramData/docker/ logs but they did not help me much.

Is there any method to force docker into verbose logging mode so I can see more info about the error?

The context is :

OS Windows 10 Pro 1809 Build 17763


two LANs and two static IPs

Hyper-v installed

Containers (from features list) installed

Docker in Windows Containers mode

Version 2.0.0.2 (30215)
Channel: stable
Build: 0b030e1

.NET Console App

using System;
using System.Threading;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            int seconds = 0;
            while (true)
            {
                Console.WriteLine($"Running for {seconds++} seconds...");
                Thread.Sleep(1000);
            }
        }
    }
}

Dockerfile

FROM microsoft/dotnet:2.2.1-runtime-nanoserver-1809 as base

FROM microsoft/dotnet:2.2.102-sdk-nanoserver-1809 as build
WORKDIR /src
COPY . .
RUN dotnet publish "ConsoleApp.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=build /app .
CMD ["dotnet", "ConsoleApp.dll"]

Running single container like this is fine :

docker build --tag=consoleapp:latest . 
docker run consoleapp:latest

Now trying simple stack in swarm with compose file which is copy-pasted from the official tutorial here :

version: "3"
services:
  web:
    image: consoleapp:latest
    deploy:
      replicas: 1
      resources:
        limits:
          cpus: "0.2"
          memory: 512M
      restart_policy:
        condition: on-failure
    ports:
      - "4000:80"
    networks:
      - webnet
networks:
  webnet:

Running :

docker swarm init --advertise-addr=MY-IP

Running :

docker stack deploy --compose-file .\docker-compose-swarm.yml conso

Inspecting with ps:

docker service ps conso_web --no-trunc

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

Running docker service inspect conso_web results in :

[
{
    "ID": "uqbuzg0r48xpp5j4x4ggny3h6",
    "Version": {
        "Index": 14
    },
    "CreatedAt": "2019-01-16T13:19:08.1388816Z",
    "UpdatedAt": "2019-01-16T13:19:08.143879Z",
    "Spec": {
        "Name": "conso_web",
        "Labels": {
            "com.docker.stack.image": "consoleapp:latest",
            "com.docker.stack.namespace": "conso"
        },
        "TaskTemplate": {
            "ContainerSpec": {
                "Image": "consoleapp:latest",
                "Labels": {
                    "com.docker.stack.namespace": "conso"
                },
                "Privileges": {
                    "CredentialSpec": null,
                    "SELinuxContext": null
                },
                "StopGracePeriod": 10000000000,
                "DNSConfig": {},
                "Isolation": "default"
            },
            "Resources": {
                "Limits": {
                    "NanoCPUs": 200000000,
                    "MemoryBytes": 536870912
                }
            },
            "RestartPolicy": {
                "Condition": "on-failure",
                "Delay": 5000000000,
                "MaxAttempts": 0
            },
            "Placement": {},
            "Networks": [
                {
                    "Target": "ym87286eyf1m2i1l5fth3eg9z",
                    "Aliases": [
                        "web"
                    ]
                }
            ],
            "ForceUpdate": 0,
            "Runtime": "container"
        },
        "Mode": {
            "Replicated": {
                "Replicas": 1
            }
        },
        "UpdateConfig": {
            "Parallelism": 1,
            "FailureAction": "pause",
            "Monitor": 5000000000,
            "MaxFailureRatio": 0,
            "Order": "stop-first"
        },
        "RollbackConfig": {
            "Parallelism": 1,
            "FailureAction": "pause",
            "Monitor": 5000000000,
            "MaxFailureRatio": 0,
            "Order": "stop-first"
        },
        "EndpointSpec": {
            "Mode": "vip",
            "Ports": [
                {
                    "Protocol": "tcp",
                    "TargetPort": 80,
                    "PublishedPort": 4000,
                    "PublishMode": "ingress"
                }
            ]
        }
    },
    "Endpoint": {
        "Spec": {
            "Mode": "vip",
            "Ports": [
                {
                    "Protocol": "tcp",
                    "TargetPort": 80,
                    "PublishedPort": 4000,
                    "PublishMode": "ingress"
                }
            ]
        },
        "Ports": [
            {
                "Protocol": "tcp",
                "TargetPort": 80,
                "PublishedPort": 4000,
                "PublishMode": "ingress"
            }
        ],
        "VirtualIPs": [
            {
                "NetworkID": "lj4p25j2ds2boxkxg7ij87h4y",
                "Addr": "10.255.0.3/16"
            },
            {
                "NetworkID": "ym87286eyf1m2i1l5fth3eg9z",
                "Addr": "10.0.0.2/24"
            }
        ]
    }
}]