博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Docker network
阅读量:5057 次
发布时间:2019-06-12

本文共 1965 字,大约阅读时间需要 6 分钟。

1 Hostnetwork 

NETWORK: HOST

With the network set to host a container will share the host’s network stack and all interfaces from the host will be available to the container. The container’s hostname will match the hostname on the host system

Compared to the default bridge mode, the host mode gives significantly better networking performance since it uses the host’s native networking stack whereas the bridge has to go through one level of virtualization through the docker daemon. It is recommended to run containers in this mode when their networking performance is critical, for example, a production Load Balancer or a High Performance Web Server.

NETWORK: BRIDGE

Isolated network within the host. With the network set to bridge a container will use docker’s default networking setup. A bridge is setup on the host, commonly named docker0, and a pair of veth interfaces will be created for the container. One side of the vethpair will remain on the host attached to the bridge while the other side of the pair will be placed inside the container’s namespaces in addition to the loopback interface. An IP address will be allocated for containers on the bridge’s network and traffic will be routed though this bridge to the container. Containers can talk to each other, and to talk to outside of the host, need to expose the port by docker run -p <exposed port of host>:<port of container> <container_name>

 

NETWORK: Overlay

overlay netwrok is designed for the comms between two containers on different host. 

To create overlay network 

docker network create -d overlay my-overlay

Start a service using the overlay network and publishing port 80 to port 8080 on the Docker host.

$ docker service create \  --name my-nginx \  --network my-overlay \ --replicas 1 \ --publish published=8080,target=80 \ nginx:latest for muti host overlay network https://docs.docker.com/network/network-tutorial-overlay/#walk-through

转载于:https://www.cnblogs.com/anyu686/p/9091533.html

你可能感兴趣的文章
cocos2d-x 2.2.6 之 .xml文件数据读取
查看>>
枚举的使用
查看>>
【HTTP】Fiddler(三)- Fiddler命令行和HTTP断点调试
查看>>
poi 处理空单元格
查看>>
Android 内存泄漏优化总结
查看>>
luogu4849 寻找宝藏 (cdq分治+dp)
查看>>
日志框架--(一)基础篇
查看>>
关于源程序到可运行程序的过程
查看>>
转载:mysql数据库密码忘记找回方法
查看>>
scratch少儿编程第一季——06、人在江湖混,没有背景怎么行。
查看>>
面向对象1
查看>>
【贪心+DFS】D. Field expansion
查看>>
C# Async与Await的使用
查看>>
Mysql性能调优
查看>>
iOS基础-UIKit框架-多控制器管理-实例:qq界面框架
查看>>
IOS-每个程序员的编程之路上都应该看这11本书
查看>>
自定义tabbar(纯代码)
查看>>
小程序底部导航栏
查看>>
ibatis学习笔记
查看>>
18-ES6(1)
查看>>