doutan3192 2018-10-14 13:05
浏览 391
已采纳

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 2018-10-14 13:07
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图