Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

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

More than 5 years have passed since last update.

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

参考

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away