kabir
kabir

Reputation: 11

Open vSwitch not working on Docker

I'm using ubuntu 14.04 and Docker version:

Client:
 Version:       17.12.1-ce
 API version:   1.35
 Go version:    go1.9.4
 Git commit:    7390fc6
 Built: Tue Feb 27 22:17:56 2018
 OS/Arch:       linux/amd64
Server:
 Engine:
  Version:      17.12.1-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.9.4
  Git commit:   7390fc6
  Built:        Tue Feb 27 22:16:28 2018
  OS/Arch:      linux/amd64
  Experimental: false

Below is my Dockerfile:

FROM ubuntu:16.04
# Install the required packages
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get -y install openvswitch-switch openvswitch-common
RUN apt-get -y install nano
RUN apt-get -y install iproute2
RUN apt-get -y install tcpdump
RUN apt-get -y install openssh-server
RUN apt-get -y install net-tools
RUN apt-get -y install iputils-ping
RUN rm -rf /var/lib/apt/lists/*

After that I'm doing:

$sudo docker build -t mhkabir/ovs-container:latest .
$sudo docker run -it mhkabir/ovs-container:latest bash

Inside container, when I try to check Open vSwitch it's showing the error:

root@60cf0a5b5cfd:/# ovs-vsctl show
ovs-vsctl: unix:/var/run/openvswitch/db.sock: database connection failed (No such file or directory)

Expecting your suggestions. thank you.

Upvotes: -1

Views: 1948

Answers (2)

Amir Rasti
Amir Rasti

Reputation: 768

this issue might be related to the directory /var/run/openvswitch/ is missing, causing the ovs-ctl daemon to fail on startup , there is two potential workarounds :

1-create the directory /var/run/openvswitch/ like RUN mkdir /var/run/openvswitch/ in your docker file

2-manually execute the /usr/share/openvswitch/scripts/ovs-ctl start command

Upvotes: 1

takaomag
takaomag

Reputation: 1635

Both ovs-vswitchd and ovsdb-server are running ?

Upvotes: -2

Related Questions