为独立容器创建覆盖网络时出错 [英] Error while creating overlay network for standalone containers

查看:71
本文介绍了为独立容器创建覆盖网络时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据Docker文档,当我们初始化docker swarm时会自动创建覆盖网络.但是我们不能将该网络用于不属于群集资源一部分的单个Docker容器.因此,我们需要使用"--attachable"创建覆盖网络.标记.

As per the Docker documentation, overlay network is automatically getting created when we initialise docker swarm. But we can not use that network for individual docker container which not part of swarm resource. So, we need to create overlay network with "--attachable" flag.

我尝试创建可附加的覆盖网络,但出现以下错误:

I tried to create attachable overlay network but I am getting following error :

docker network create -d overlay --attachable my-attachable-overlay 
Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.

我们需要在swarm管理器上运行此命令吗?我们不能在不初始化docker swarm的情况下直接在像boot2docker这样的轻型容器上使用它吗?

Do we need to run this command on swarm manager ? Can't we use it directly on low weight container like boot2docker without initialising docker swarm ?

推荐答案

群集范围的覆盖网络驱动程序确实确实需要群集.如果您只有一个节点,则只需执行 docker swarm init ,然后可以创建群集范围的网络.如果在群集工作节点上遇到此错误,则只需在群集中的管理器上创建网络,然后就可以在该群集中的工作节点上使用该网络.

The swarm scoped overlay network driver does indeed require swarm. If you have a single node, you only need to do docker swarm init and then you can create a swarm scoped network. If you are getting this error on a swarm worker node, then you just need to create the network on a manager in the swarm and then it can be used on the worker nodes in that swarm.

覆盖网络驱动程序的全部目的是实现群集中多个节点之间的容器到容器通信.既不必在不打算使用任何其他群集功能也不希望与其他节点上的容器进行通信的单个节点中使用覆盖网络驱动程序,则没有必要.改用本地作用域网络驱动程序,例如 bridge .

The whole purpose of the overlay network driver is to enable container-to-container communication between multiple nodes in a swarm. It is not necessary to use the overlay network driver in a single node where you do not intend to use any other swarm features nor communicate with containers on other nodes. Use a local scoped network driver instead like bridge.

这篇关于为独立容器创建覆盖网络时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆