'ovs-docker: Failed to get the PID of the container

I am trying to test SDN with Openvswitch and docker

The command I run:

Step 1. docker run -d -i --name routerA --net=none --privileged alpine sh

Step 2. sudo ovs-vsctl add-br vnbr

Step 3. ovs-vsctl set bridge vnbr protocols=OpenFlow13

Step 4. sudo ovs-vsctl show Gives the output:

sdn@ubuntu:~/Desktop/test_sdn$ sudo ovs-vsctl show
0037c239-799b-4fec-a3b5-a14ec7fa2c7e
    Bridge vnbr
        Port vnbr
            Interface vnbr
                type: internal
    ovs_version: "2.13.3"

Step 5. sudo ovs-docker add-port vnbr eth0 routerA --ipaddress="10.0.1.1/24"

However, at this step, it shows the error:

Error: No such object: routerA
ovs-docker: Failed to get the PID of the container

My docker ps:

sdn@ubuntu:~/Desktop/test_sdn$ docker ps -a
CONTAINER ID   IMAGE                  COMMAND                  CREATED             STATUS                         PORTS     NAMES
c9e8eaa47403   alpine                "sh"                     10 minutes ago      Up 10 minutes                            routerA
....

but I can run docker inspect routerA

docker inspect routerA
[
    {
        "Id": "c9e8eaa47403acdfffaaae14bbfeb008f69591dfdd6795ac9e1785d4bd60f29a",
        "Created": "2022-03-15T14:48:05.417161661Z",
     ...

How can I fix this problem? By the way, can I use ovs-docker to a k8s pod? thanks!!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source