Docker端口绑定失败.为什么“权限被拒绝"?

编程入门 行业动态 更新时间:2024-10-25 06:29:58
本文介绍了Docker端口绑定失败.为什么“权限被拒绝"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试在Windows 10 Pro(最新)下启动jenkinsci/blueocean容器.我正在运行脚本:

I'm trying to start a jenkinsci/blueocean container under Windows 10 Pro (latest). I'm running a script:

docker run ^ --rm ^ -u root ^ -d ^ -p 8080:8080 ^ -p 50000:50000 ^ -v D:/docker/jenkins/volumes/jenkins-data:/var/jenkins_home ^ -v D:/docker/jenkins/volumes/docker.sock:/var/run/docker.sock ^ -v D:/docker/jenkins/volumes/home:/home ^ jenkinsci/blueocean

此操作失败,并显示以下消息:

This fails with the following message:

docker: Error response from daemon: driver failed programming external connectivity on endpoint elastic_kare: Error starting userland proxy: Bind for 0.0.0.0:50000: unexpected error Permission denied

如果我忽略端口50000的绑定,它可以正常工作,但是我需要50000端口才能与主机上的从属进行通信.

If I leave out the binding of port 50000 it works fine, but I need the 50000 port to communicate with the slaves on the host.

将50000绑定到另一个端口无济于事.根据netstat -an,该端口未使用.尝试以管理员身份运行脚本无济于事.

Binding 50000 to another port doesn't help. The port is not in use, according to netstat -an. Trying to run the script as Administrator didn't help.

这里可能是什么问题?

更新:我重新启动了笔记本电脑,并将Docker桌面也更新到了最新版本.

update: I restarted my laptop and updated Docker Desktop to the latest version as well.

update2:重新启动笔记本电脑后,我也重新启动了Docker(几次).无济于事.

update2: after restarting laptop I restarten Docker (several times) as well. To no avail.

update3:关闭Windows防火墙并不能解决问题.

update3: shutting down the Windows Firewall did not solve the problem.

推荐答案

如果您在Windows上运行Docker,则它将使用Hyper-V-我发现Hyper-V保留了大量端口-您可以通过运行以下命令找出答案:

If you're running Docker on Windows then it will be using Hyper-V - I've found that Hyper-V reserves a bunch of ports - you can find out by running this:

netsh interface ipv4 show excludedportrange protocol=tcp

在我的机器上,我可以看到它保留了端口50000.要释放此端口,我禁用了Hyper-V:

On my machine I could see it had reserved port 50000. To free this port up I disabled Hyper-V:

dism.exe /Online /Disable-Feature:Microsoft-Hyper-V

重启后,我保留了端口50000:

After the reboots, I reserved port 50000:

netsh int ipv4 add excludedportrange protocol=tcp startport=50000 numberofports=1

然后再次启用Hyper-V:

Then enabled Hyper-V again:

dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All

恢复后,我可以在Windows的Docker中运行Jenkins:

When it came back up I could run Jenkins in Docker on Windows:

docker run -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts

更多推荐

Docker端口绑定失败.为什么“权限被拒绝"?

本文发布于:2023-11-14 09:08:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1586803.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:绑定   端口   被拒   权限   Docker

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!