Docker on Windows sometimes lock your ports, even after the deletion of your container, during an undetermined duration.
The simplest thing you have to do is to restart docker and the port are no longer locked.
I recently experienced an error while I was trying to test locally my Golang API.
My API was exposed on the port 8080:
log.Fatal(http.ListenAndServe(":8080", router))
My final docker file expose the API on the same port:
FROM scratch
WORKDIR /app
COPY ./fooAPI.exe /app/fooapi
COPY ./cmd/fooAPI/conf.json /app
# tell we are exposing our service on port 8080
EXPOSE 8080
# run it!
CMD ["./fooapi"]
When I was trying to run my docker image, I had the following error message:
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: driver failed programming external connectivity on endpoint fooapi (f6d5bed281ad1e8c1c56770cc1c05e3b5a7f8a05abd8265ae3a4007eeb3ff895):
Error starting userland proxy: mkdir /port/tcp:0.0.0.0:8080:tcp:172.17.0.2:8080: input/output error
Event after the deletion of the previous containers by using the command below:
docker rm $(docker ps -a -q)