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. Amontec JTAGkey (FT2232)

    The JTAGkey is based on the FTDIChip FT2232L, is a USB 2.0 device and is used for: On-Chip Debugging ...

  2. systemtap 安装 总结

    http://blog.soul11201.com/notes/2017/02/22/systemstap-install.html

  3. Snmp学习总结(四)——WinServer2003安装和配置SNMP

    一.安装SNMP 今天讲解一下在WinServer2003安装和配置SNMP,具体操作步骤如下: 找到[控制面板]→[添加或删除程序]

  4. CentOS MongoDB 高可用实战

    原文:https://www.sunjianhua.cn/archives/centos-mongodb.html 一.MongoDB 单节点 1.1.Windows 版安装 1.1.1 获取社区版本 ...

  5. C# String.split()用法小结

    第一种方法 string s=abcdeabcdeabcde; string[] sArray=s.Split('c') ; foreach(string i in sArray) Console.W ...

  6. 详细注释!二维码条码扫描源码,使用Zxing core2.3

    from:http://www.eoeandroid.com/forum.php?mod=viewthread&tid=325529&page=1 现如今很多项目中都会应用到条码扫描解 ...

  7. 使用PHP+Sphinx建立高效的站内搜索引擎

      1.    为什么要使用Sphinx   假设你现在运营着一个论坛,论坛数据已经超过100W,很多用户都反映论坛搜索的速度非常慢,那么这时你就可以考虑使用Sphinx了(当然其他的全文检索程序或方 ...

  8. ibatis.net:第三天,Insert

    手工生成主键的模型 xml 配置 <insert id="InsertUser" parameterClass="User"> INSERT INT ...

  9. Linux学习2-在阿里云服务器上部署禅道环境

    前言 以前出去面试总会被问到:测试环境怎么搭建?刚工作1-2年不会搭建测试环境还可以原谅自己,工作3-5年后如果还是对测试环境搭建一无所知,面试官会一脸的鄙视. 本篇以最简单的禅道环境搭建为例,学习下 ...

  10. pthread_attr_init线程属性

    转自:http://blog.csdn.net/pbymw8iwm/article/details/6721038 1.线程属性 线程具有属性,用pthread_attr_t表示,在对该结构进行处理之 ...