简体   繁体   English

同一主机中的docker容器是否具有相同的端口

[英]Can docker containers within same host have same ports

I am a noob to docker and I was reading the docs: 我是码头工人的菜鸟,我正在阅读文档:

Networks, by definition, provide complete isolation for containers. 根据定义,网络为容器提供完全隔离。

Does that mean I can have nginx service on port 80 in each container in the same host, and start each image to use port 80 within it's own container and map the ports: 这是否意味着我可以在同一主机中的每个容器中的端口80上使用nginx服务,并启动每个映像以在其自己的容器中使用端口80并映射端口:

eg. 例如。

8080:80 <--- container 1
8081:80 <--- container 2

Yes. 是。 Did you try this? 你试过这个吗? It should work just fine. 它应该工作得很好。

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

相关问题 是否可以在同一主机上运行多个 nginx docker 容器? - Is it possible to run multiple nginx docker containers on the same host? 同一主机上的两个容器之间的通信 - Communication between two containers on the same host 使用Nginx映射Docker容器端口 - Map docker containers ports with nginx 可以侦听多个端口并将它们代理传递给 NGINX 中的同一台主机吗? - Can listen on multiple ports and proxy_pass them to the same host in NGINX? 具有相同域的端口80上的多个Docker容器 - Mulitple Docker Containers on Port 80 with Same Domain Docker-组合起始容器两次,运行命令两次并具有相同的内容 - Docker-compose starting containers twice, running command twice and have same content Nginx 如何将不同站点托管到同一域但在不同端口上 - Nginx how to host different sites to the same domain but on different ports 如何访问同一容器内Docker容器的多个端口? - How to access several ports of a Docker container inside the same container? 考虑 URL 重定向:如何使用 web 应用程序的 GUI 在远程服务器上的同一 docker 网络中的不同容器中运行? - Considering URL redirections: How to use GUIs of web applications running in different containers within the same docker network on a remote server? 将域而不是端口用于多个Docker容器 - Use domains instead of ports for multiple Docker containers
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM