compose icon indicating copy to clipboard operation
compose copied to clipboard

windows random failures docker-compose up - failed to create endpoint [[service]] on network nat

Open pennywisdom opened this issue 9 years ago • 11 comments

docker-compose up is failing randomly on windows server 2016. Details below. Seems similar to 335 which was closed due to inactivity not with a resolution as far as I can see.

In my situation for the data below, I am standing up 4 or 5 services in the compose file and sometimes it succeeds and sometimes it fails. Seems quite random.

Expected behavior

docker-compose up -d --no-build should bring up multiple services defined in the docker-compose.yml file

Actual behavior

docker-compose up fails randomly with messages similar to

failed to create endpoint [[service]] on network nat

The process is failing randomly for random services.

Information

The output from the following script - https://aka.ms/Debug-ContainerHost.ps1 is (please note that windowsservercore and nanoserver are being cleaned up by docker system prune) so the images declared in the docker-compose.yml file are being pulled when missing and in turn this dependencies are being satisfied by docker as I would expect.

Checking for common problems Describing Windows Version and Prerequisites Info 15:57:10 [+] Is Windows 10 Anniversary Update or Windows Server 2016 979ms [+] Has KB3192366, KB3194496, or later installed if running Windows build 14393 229ms [+] Is not a build with blocking issues 137ms [+] Has 'Containers' feature installed 1.01s Describing Docker is installed Info 15:57:12 [+] A Docker service is installed - 'Docker' or 'com.Docker.Service' 154ms [+] Service is running 52ms Info 15:57:16 [+] Docker.exe is in path 4.09s [+] Docker is registered in the EventLog service 42ms Describing User has permissions to use Docker daemon [+] docker.exe should not return access denied 75ms Describing Windows container settings are correct [+] Do not have DisableVSmbOplock set to 1 55ms [+] Do not have zz values set 47ms Describing The right container base images are installed [-] At least one of 'microsoft/windowsservercore' or 'microsoft/nanoserver' should be installed 196ms ValidationMetadataException: The argument is null or empty. Provide an argument that is not null or empty, and then try the command again. ParameterBindingValidationException: Cannot validate argument on parameter 'Property'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again. at , : line 109 Describing Container network is created Info 15:57:20 [+] At least one local container network is available 3.9s [+] At least one NAT, Transparent, or L2Bridge Network exists 62ms [+] NAT Network's vSwitch is internal 43ms [+] Specified Network Gateway IP for NAT network is assigned to Host vNIC 102ms [+] NAT Network's internal prefix does not overlap with external IP' 88ms Showing output from: docker info Containers: 4 Running: 3 Paused: 0 Stopped: 1 Images: 4 Server Version: 1.13.1 Storage Driver: windowsfilter Windows: Logging Driver: json-file Plugins: Volume: local Network: l2bridge l2tunnel nat null overlay transparent Swarm: inactive Default Isolation: process Kernel Version: 10.0 14393 (14393.693.amd64fre.rs1_release.161220-1747) Operating System: Windows Server 2016 Standard OSType: windows Architecture: x86_64 CPUs: 4 Total Memory: 3.997 GiB Name: xxxxx ID: U7WK:4ML4:4BDA:SDJF:2XDD:Q4IG:HBKQ:D23L:JAWM:ABIK:SXYZ:WPJK Docker Root Dir: C:\ProgramData\docker Debug Mode (client): false Debug Mode (server): true File Descriptors: -1 Goroutines: 37 System Time: 2017-02-21T15:57:12.9507604Z EventsListeners: 0 Registry: https://index.docker.io/v1/ Labels: hosttype=windows dc=xxxx hostrole=xxx Experimental: false Insecure Registries: 192.168.xxx.xxx:5000 localhost:5000 127.0.0.0/8 Live Restore Enabled: false Showing output from: docker version Client: Version: 1.13.1 API version: 1.26 Go version: go1.7.5 Git commit: 092cba3 Built: Wed Feb 8 08:47:51 2017 OS/Arch: windows/amd64 Server: Version: 1.13.1 API version: 1.26 (minimum version 1.24) Go version: go1.7.5 Git commit: 092cba3 Built: Wed Feb 8 08:47:51 2017 OS/Arch: windows/amd64 Experimental: false Showing output from: docker network ls NETWORK ID NAME DRIVER SCOPE 08862edda91a nat nat local 6eddbc707551 none null local

The error logs contain this:

Handler for POST /v1.25/containers/d7502a1511da4d26983746b02b30740c4dc58eace250e21b36de522e36826827/start returned error: failed to create endpoint scsprint_query_1 on network nat: HNS failed with error : Unspecified error

Steps to reproduce the behavior

run docker-compose up -d --no-build randomly on windows server 2016 and fails randomly with for random services.

pennywisdom avatar Feb 21 '17 17:02 pennywisdom

See Michael's comment on https://github.com/docker/compose/issues/4482#issuecomment-279823497

shin- avatar Feb 21 '17 21:02 shin-

Thanks @shin- . Hmm strange, I am using the the model suggested with the external NAT network setting in my compose files. Also, just to highlight that the error in the logs is unspecified, so I'm kind of searching in the dark regarding this.

failed to create endpoint scsprint_query_1 on network nat: HNS failed with error : Unspecified error

The thing is, the same compose configuration works 80% of the time then will fail. I run the deployment in a cycle hourly as I'm looking to test the reliability on Windows. The compose file does not change in there cycles.

pennywisdom avatar Feb 22 '17 09:02 pennywisdom

@friism Do you have any idea for this one? I assume it has to do with networking in the Windows Engine.

shin- avatar Feb 22 '17 19:02 shin-

Is there any enhanced logging I can enable to help with this. Over the last few days I still seem to get up to a 10% failure rate. Which always gets fixed by simple running the same up script. If its network related, is then anything here I can log / monitor?

pennywisdom avatar Feb 24 '17 09:02 pennywisdom

@pennywisdom I think at this point it's simpler to use the true overlay networking functionality. Here's an example: https://github.com/friism/MusicStore/blob/master/docker-compose.windows.yml

You may need a hacked version of docker-compose for now: https://github.com/docker/compose/pull/4794

friism avatar May 05 '17 17:05 friism

thanks @friism . I am now trying the overlay driver as i would like to create a few different networks on a host (for isolation) and am getting errors similar to:

Cannot start service [name]: attaching to network failed, make sure your network options are correct and check manager logs: context deadline exceeded

Been searching the various repos and issues and can't seem to find anything that will resolve this.

I configured like so:

docker swarm init (just a single node)
docker network create -d overlay --attachable --subnet 10.1.1.0/24 app_net

inside docker-compose i have now:

networks:
  external:
    name: app_get

pennywisdom avatar May 08 '17 12:05 pennywisdom

Can you post a simple docker-compose file and series of steps that reproduce the problem?

On Mon, May 8, 2017 at 5:31 AM Alex Harrington [email protected] wrote:

thanks @friism https://github.com/friism . I am now trying the overlay driver as i would like to create a few different networks on a host (for isolation) and am getting errors similar to:

Cannot start service [name]: attaching to network failed, make sure your network options are correct and check manager logs: context deadline exceeded

Been searching the various repos and issues and can't seem to find anything that will resolve this.

I configured like so:

docker swarm init (just a single node) docker network create -d overlay --attachable --subnet 10.1.1.0/24 app_net

inside docker-compose i have now: networks: external: name: app_get

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/docker/compose/issues/4521#issuecomment-299853874, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHsmKZMsrQSKlnaQrAkxyzf2mazQCDLks5r3wsYgaJpZM4MHnmQ .

-- http://friism.com/ (650) 318-1051 Sapere aude

friism avatar May 08 '17 14:05 friism

--set swarm mode docker swarm init --advertise-addr 192.168.xxx.xx:2237 --listen-addr 192.168.xxx.xx:2237

--create overlay network docker network create -d overlay --attachable app

-- bring up docker-compose.exe -f .\docker-compose.test.yml up

--docker-compose.test.yml

---
version: '3.2'
services:

  proxy:
    image: stefanscherer/traefik-windows:v1.1.2-windows.1
    ports:
      - '80:80'
      - '443:443'
      - '8080:8080'
    # we need the IP of the vEthernet (HNS Internal NIC), you can get this from running 'ipconfig'
    command: --web --docker --docker.endpoint=tcp://${DOCKER_API_HOST}:${DOCKER_API_PORT} --logLevel=DEBUG
    labels:
      - "traefik.backend=proxy"
    volumes:
      - ./traefik:C:/etc/traefik

  portainer:
    image: portainer/portainer:windows-amd64-1.11.2
    ports:
      - "9000:9000"
    command: -H tcp://${DOCKER_API_HOST}:${DOCKER_API_PORT}
    labels:
      - "traefik.backend=portainer"
      - "traefik.frontend.rule=Host:portainer.docker.local"

networks:
  default:
    external:
      name: app  
docker info
Containers: 4
 Running: 0
 Paused: 0
 Stopped: 4
Images: 46
Server Version: 17.05.0-ce-rc1
Storage Driver: windowsfilter
 Windows:
Logging Driver: json-file
Plugins:
 Volume: local
 Network: l2bridge l2tunnel nat null overlay transparent
Swarm: active
 NodeID: cg7tqlvz32pryqwo7cp56kvrp
 Is Manager: true
 ClusterID: jjgcwt0gv9fgr5eg39e5zrxe6
 Managers: 1
 Nodes: 1
 Orchestration:
  Task History Retention Limit: 5
 Raft:
  Snapshot Interval: 10000
  Number of Old Snapshots to Retain: 0
  Heartbeat Tick: 1
  Election Tick: 3
 Dispatcher:
  Heartbeat Period: 5 seconds
 CA Configuration:
  Expiry Duration: 3 months
 Node Address: 192.168.226.62
 Manager Addresses:
  192.168.226.62:2237
Default Isolation: hyperv
Kernel Version: 10.0 14393 (14393.693.amd64fre.rs1_release.161220-1747)
Operating System: Windows 10 Enterprise
OSType: windows
Architecture: x86_64
CPUs: 4
Total Memory: 15.89GiB
Name: xxxxx
ID: PW6K:VCEH:T34B:IKQZ:3CLU:JVRA:YA33:H4SU:HYBU:OIJ3:WYVE:CDUN
Docker Root Dir: C:\ProgramData\Docker
Debug Mode (client): false
Debug Mode (server): false
Username: xxxx
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

pennywisdom avatar May 08 '17 14:05 pennywisdom

Whats the status on this? Solved? I'm having all the same problems is there any point to even Open another ticket on this?

pradley avatar Oct 09 '17 21:10 pradley

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 10 '19 00:10 stale[bot]

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

stale[bot] avatar Oct 17 '19 01:10 stale[bot]