docker: Error response from daemon: driver failed programming external connectivity on endpoint

This one is going to be quick post where I ran into following error with docker while trying to start a mssql linux container from a windows 10 machine

 E:\>docker run -p 1433:1433 --name mssqlverification -v mssqldata:/var/opt/mssql/data -d company/mssql-external
ba97afdcaf554a8af81c946896940ad071c3bb9b3924889dae05bcb7821e56b1
docker: Error response from daemon: driver failed programming external connectivity on endpoint mssqlverification (07e38668d0f1a46dddd97585377310f80b330ddb281771d33f5556900b5da9fd): Error starting userland proxy: mkdir /port/tcp:0.0.0.0:1433:tcp:172.17.0.2:1433: input/output error.

There are many github issues like this one and this,this  opened for the same issue . I followed these steps and it worked fine for me.Hope any of this steps help you

  • Check if the port is already used by any other process with these command
 netstat -ano|find ":1433"

1433 is the port you are looking for .If this command  returns any output,you have to stop the process using that port.

e.g for port 3001

 E:\>netstat -ano|find ":3001"
 TCP 0.0.0.0:3001 0.0.0.0:0 LISTENING 8548
 TCP [::1]:3001 [::]:0 LISTENING 8548

E:\>tasklist|find "8548"
vpnkit.exe 8548 Console 3 24,116 K

In the above command ,I was running another docker on port 3001 and vpnkit was used by docker itself.

  • Check the hello world container works for you

 

 E:\>docker run -it hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 (amd64)
 3. The Docker daemon created a new container from that image which runs the
 executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
 to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://cloud.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

Also if you are on windows ,you can also check whether you are using Linux Or Windows Containers.You can change to windows containers from the docker tray on windows as shown below

switch to windows containers

Now you have to rerun the hello world again and verify.

 E:\>docker run -it hello-world
  • If the issue is with the Linux Containers,stop the docker and restart your machine.  This should solve the issue.