简体   繁体   English

外部访问Docker容器

[英]External access to the docker containers

Is it possible to make docker containers (network) visible for another computers in local network without exposing ports to the host machine where containers placed? 是否可以使Docker容器(网络)对于本地网络中的另一台计算机可见,而无需将端口暴露给放置容器的主机? 在此处输入图片说明

I have a local network that contains several machines. 我有一个包含多台计算机的局域网。 One of these (192.168.1.10) has docker containers (dns, nginx, mysql) and also this machine has nginx and mysql installed on itself. 其中一个(192.168.1.10)具有docker容器(dns,nginx,mysql),并且该计算机本身还安装了nginx和mysql。

I want to get access to the dns/nginx from another machines in the local network. 我想从本地网络中的另一台计算机访问dns / nginx。 Is it possible without exposing ports to the host machine? 是否可以不将端口暴露给主机?

ps excuse me for my english ps请原谅我的英语

You can do this using DNAT (destination NAT) internally. 您可以在内部使用DNAT(目标NAT)进行此操作。 You will need a layer 3 device that does this though. 但是,您将需要执行此操作的第3层设备。

Example: you create a "VIP" 192.168.1.111 on port XYZ. 示例:您在端口XYZ上创建一个“ VIP” 192.168.1.111。 This will be NATed to the IP address of 192.168.1.10 on port say 53 (for DNS) or another port of your choice. 这将在端口53(对于DNS)或您选择的其他端口上NAT为IP地址192.168.1.10。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM