doutan3192
doutan3192
2018-10-14 13:05

Windows上的Docker-端口已锁定

已采纳

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)
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • douyan9417 douyan9417 3年前

    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.

    点赞 评论 复制链接分享

为你推荐