12
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Dockerコンテナを直接OpenvSwitchに接続するには(lxcドライバ使用)

Last updated at Posted at 2015-08-31

dockerのドライバをlxcに変更

dockerサービスを一旦止めて
service docker.io stop
再起動(lxcドライバ指定)
docker -d -e lxc
端末一個取られるのでscreenとか使っとくべき

OpenvSwitchでブリッジ作成

ovs-vsctl add-br ovs-br0
これだけでOK
ポートとかはコンテナが起動した時に作成する

Dockerコンテナ起動

起動コマンド

run.sh
docker run -i -t \
--net=none \
--lxc-conf='lxc.network.type=veth' \
--lxc-conf='lxc.network.ipv4=192.168.111.50' \
--lxc-conf='lxc.network.flags=up' \
--lxc-conf='lxc.network.name=eth0' \
--lxc-conf='lxc.network.script.up=/home/ovs_ifup/ovs-br0' \
--lxc-conf='lxc.network.script.down=/home/ovs_ifdown/ovs-br0' \
trema_controller:latest /bin/bash`
ovs_ifup/ovs-br0
#!/bin/bash
sudo ifconfig $5 0.0.0.0 up
sudo ovs-vsctl add-port ovs-br0 $5
ovs_ifdown/ovs-br0
#!/bin/bash
sudo ifdown $5
sudo ovs-vsctl del-port ovs-br0 $5

参考

12
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?