我有 docker 镜像(来自私有(private)原子存储库),我在 Docker(Windows10)中作为容器运行,一切都很好:
docker run -d --net siecDocker --ip 172.18.0.22 --name UF -v /opt/DOCKER:/DEPLOY -p 9080:9080 -p 9043:9043 -p 9060:9060 ufek:1.0
我对本地和远程端口 9043,9060,9080 上的应用程序和 url 地址回答没有问题。
当我从 centos7 上的存储库中提取此图像并运行它时,容器正在与我的应用程序一起运行,但端口没有响应。
这是相同的图像!运行的语法也是一样的。
我不知道怎么了?
其他图片都还好,只有这个有问题。
最佳答案
我相信我现在可以看到这个问题。你 sestatus
显示 Current mode: enforcing
.这意味着它处于严格模式,并且只允许允许的连接。
编辑/etc/selinux/config
文件并将模式更改为许可
/etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=permissive
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
重新启动您的centos机器,一切应该开始工作
关于Docker 容器(Windows10、Centos7)端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46105703/