I use the socketplane/openvswitch docker image. When I follow their instructions to build and execute OVS commands in a running container, everything works fine. However, when I try to build a bash script for running and executing OVS commands the container returns with
db.sock: Database connection failed (Connection refused)
Actually the problem is running the following commands in a terminal:
docker run -itd --cap-add NET_ADMIN [container-name]
docker exec $cid ovs-vsctl show
succeeds, but running same commands in a bash script does not.
This is my bash script:
#!/bin/bash
cid=$(docker run -itd --cap-add NET_ADMIN [container-name])
docker exec $cid ovs-vsctl show
Thanks