Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to create endpoint on network nat: hnsCall failed in Win32: The process cannot access the file

I'm trying to run the following docker command (latest Win10 Fall 2018 update, latest docker version 2.0):

docker run -d -p 1433:1433 -e sa_password=Test_123 -e ACCEPT_EULA=Y microsoft/mssql-server-windows-developer

But it fails wit the following error:

Error response from daemon: failed to create endpoint unruffled_wozniak on network nat: hnsCall failed in Win32: The process cannot access the file because it is being used by another process. (0x20).

I've tried the following:

  • restart daemon
  • docker system prune -a
  • restart machine
  • restart HNS service
  • reinstall docker
  • disable from Windows features the container and Hyper-V

Nothing worked. Any suggestions?

like image 833
user3365017 Avatar asked Dec 18 '18 15:12

user3365017


3 Answers

Not sure how wise this is, but I checked the port wasn't in use with another app and still got the error.

This has fixed the issue a couple of times for me. In an Administrative PowerShell console, run the following:

Stop-Service docker
Stop-service hns
Start-service hns
Start-Service docker
docker network prune

Partially sourced from this post.

like image 132
Andy Joiner Avatar answered Nov 04 '22 06:11

Andy Joiner


I had the same issue while trying to get PostgreSQL running with Docker. The problem was that the port was already tied up! This was because I had already had PostgreSQL running as a normal database in my OS.

My fix was finding the postgresql-x64-10 service in the Task Manager (under Services) and stopping the service.

the solution probably sounds obvious but I thought I'd mention it anyway

like image 40
harvzor Avatar answered Nov 04 '22 07:11

harvzor


I was running into the same error, but stopping the SQL Server service running on my local machine on port 1433 wasn't an option, so I simply mapped a different port to the container. I replaced the port mapping parameters with the following:

-p 1434:1433

This will map your local machine's port 1434 to the container's port 1433. If your local machine's port 1434 is also in use, you'll have to find a port that is available for you.

Once you have that in place, if you want to get in with SSMS, you'll just need to tell it to connect over port 1434 by using a comma:localhost,1434

SQL Server Connection Dialog

like image 9
Nick Ligerakis Avatar answered Nov 04 '22 07:11

Nick Ligerakis