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

I'm going through this tutorial

making docker image with: docker build -t myapp_back .

and then want to run container with: docker run -p 3000:3000 -d myapp_back

it's simlpe node/express app

But I'm getting an error:

C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: driver failed programming external connectivity on endpoint wizardly_wescoff (a7c53e0d168f915f900e3d67ec72805c2f8e4f5e595f6ae3c7fed8e097886a8b): Error starting userland proxy: mkdir /port/tcp:0.0.0.0:3000:tcp:172.17.0.2:3000: input/output error.

What's wrong?

my dockerfile:

FROM node:carbon
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ['npm', 'start']

and start in package.json:

"start": "nodemon src/app.js --exec babel-node"


Solution 1:[1]

To solve the following error in Windows: just Restart Docker (from tray menu or selecting the 'Restart Docker...' option in Settings/Reset)

Cannot start service YOUR_SERVICE: driver failed programming external connectivity on endpoint ...

Solution 2:[2]

Looks like it is a known issue from docker: https://github.com/docker/for-win/issues/573

Try:

  1. disabling "Experimental Features" in the Settings/Daemon menu
  2. restarting docker
  3. stopping all containers.

To stop all containers, run: docker ps -a -q | ForEach { docker stop $_ }

EDIT: Working ShellScript code to Stop All Containers

for a in `docker ps -a -q`
do
  echo "Stopping container - $a"
  docker stop $a
done

Solution 3:[3]

Just restarted my computer and it works now..

Solution 4:[4]

I am able to get docker working on my windows 10 pc by resetting docker to the factory defaults. Restarting docker, restarting my machine did not work.

Solution 5:[5]

Restarting the computer is not the actual fix, just a workaround, that one would need to be doing on a frequent basis.

The problem is related with the default windows 10 shutdown behaviour.

The actual fix can be achieved disabling windows fast startup settings:

Control Panel -> Power Options -> Choose what the power button does -> Change settings that are currently unavailable -> Toggle Turn on fast startup

Solution 6:[6]

On Mac Mojave, run the following command to find which processes are using the port.

sudo lsof -i @localhost:<port_no>

In my case I was checking port 8080 so I run

sudo lsof -i @localhost:8080

I found that the http-alt is running on port 8080 and after getting the process id using above command you can kill the processes by

sudo kill -9 <process_id>

However, in my case four applications ArtemisSe, Mail, Google and Slack are using http-alt on port 8080. Since they look important applications so I changed my port and run the container on 8888 instead of 8080. i.e.

docker run -it --rm -p 8888:8080 <imageid or image name>

Solution 7:[7]

I am running under linux. If I run docker as root with the sudo command, it works fine.

Solution 8:[8]

Just restart docker, right click on its icon then restart. that solved my problem

Solution 9:[9]

In my case, the same error in PHP Container. I solve changing the public port and works.

This command throw error after restart my Windows 10:

docker run -d -p 8080:80 --name php_apache php_app

Solution:

docker run -d -p 8081:80 --name php_apache php_app

Solution 10:[10]

Just run this command to stop your all containers

It worked for me.

for a in docker ps -a -q do echo "Stopping container - $a" docker stop $a done