In previous postwe have seen how to link two container together by using `--link`:

# docker run -d --name my-mongodb mongo
# docker run -d -p : --link my-mongodb:mongodb --name nodeapp danwahlin/node

In this poist, we are going to see how to create brige network, and link contianer inside network.

First, we can create a network:

docker network create --driver bridge isolated_network

We can inspect our network:

docker network inspect isolated_network

Once we add container into network, this command is helpful.

Run the MongoDB container and link it into network, also give it a name 'mongodb'

docker run -d --net=isolated_network --name mongodb mongo

Run the nodejs container and link it to network, also give it a name 'nodeapp':

docker run -d -p : --net=isolated_network --name nodeapp danwalin/node

Linking container into network is useful for tow or three containers, but once we have more containers, it is not convenient to write so many command lines to get job done. Instead we can use Docker Compose for this task.

[Docker] Driver Bridge network for linking containers的更多相关文章

  1. Linking Containers Together

    Linking Containers Together In the Using Docker section we touched on connecting to a service runnin ...

  2. Docker Libnetwork Bridge插件实现代码分析----创建网络部分

    // drivers/bridge/bridge.go // Create a new network using bridge plugin 1.func (d *driver) CreateNet ...

  3. Docker Libnetwork Bridge插件实现代码分析----初始化部分

    Bridge driver数据结构如下所示: type driver struct { config *configuration network *bridgeNetwork natChain *i ...

  4. 记一次 Docker swarm - overlay network access error

    背景 之前使用Docker swam 在不同的服务器 (docker host) 上面创建了service,他们之间的container通过overlay的网络通信. 昨天由于公司网络维护,其中一台服 ...

  5. Docker的bridge和macvlan两种网络模式

    项目上部署的Docker集群创建的容器网络遇到问题,借机会学习了一下docker的网络模式,其他类型我们用的不多,这里只列举我们常用的bridge和macvlan两种,下面的描述和截图有一些是直接从网 ...

  6. docker学习之network:初识网络配置

    起因 我的开发环境需要一个python代码运行环境.reids服务和mysql服务. 由于以前,我的开发环境是mac,而CI和线上运行环境是centos,偶尔会出项本地单元测试跑不过,而CI可以过.这 ...

  7. Docker实践(4)—network namespace与veth pair

    network namespace 创建network namespace # ip netns add blue # ip netns list blue   添加网口到namespace 先创建v ...

  8. docker stack删除network失败

    现象描述 删除stack的时候没太多提示,但再启动相同的stack会报错,提示网络创建失败:随后使用network ls命令可以看到之前的network还在: 使用docker network rm还 ...

  9. Docker 错误:network xxx id xxxx has active endpoints

    问题描述:Docker Compose 部署的项目,使用docker-compose down 命令关闭时,提示错误: Removing network xxxl_default ERROR: net ...

随机推荐

  1. jquery 网页局部打印总结

    最近开发过程中遇到了js局部打印的功能,在网上找相关的资料,最终找到了juery.jqprint-0.3.js 和jquery.PrintArea.js两种. 最初使用的是jquery.jqprint ...

  2. Linux 下smi/mdio总线通信

    Linux 下smi/mdio总线通信 韩大卫@吉林师范大学 下面代码描述了在用户层访问smi/mdio总线, 读写phy芯片寄存器的通用代码.Linux内核2.6以上通用. 将下面代码编译后,将可执 ...

  3. perl解析xml-XML::Simple/XMLin

    转自: http://blog.charlee.li/perl-xml-simple/ [Perl]用XML::Simple解析XML文件 在Perl中解析XML的方法最常见的就是使用 XML::DO ...

  4. Cygwin、MinGw、mingw-w64,MSys msys2区别与联系

    https://www.biaodianfu.com/cygwin-ming-msys.html http://www.mingw-w64.org/doku.php http://blog.csdn. ...

  5. leetcode 题解 || Valid Parentheses 问题

    problem: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if ...

  6. ASP.NET Web API中展示实体Link相关的方面

    有时候,向服务端请求一个实体,我们希望返回如下的格式: links: [    href: http://localhost:8901/api/user/diaries/2013-08-17,    ...

  7. C#编程(六十二)---------LINQ标准的查询操作符

    LINQ标准的查询操作符 首先我们来看一下LINQ的操作符,可根据查询操作符的操作”类型”进行分类,如把它们分成投影,限制,排序,联接,分组,串联,聚合,集合,生成,转换,元素,相等,量词,分割等. ...

  8. WordPress主题开发:WP_Query常用参数

    常用参数 用途 调用文章或页面 s 查询和某个关键词相关的所有的文章/页面信息 p 文章或页面id post__in 多篇id post__not_in 多篇id以外 post_type 查询的信息类 ...

  9. cvCreateStumpClassifier

    CV_BOOST_IMPL CvClassifier* cvCreateStumpClassifier( CvMat* trainData, //训练样本的数据,包含图像大小.数量,类别,权重等 in ...

  10. .NET:注意 Primitive 这个小坑

    背景 有个需求,需要递归遍历类型的所有属性(属性的属性),然后对不同的类型做不同的处理,或者只是将类型分为三类:Primitive.Complex 和 Collection.因为 MS 的 Type ...