cri-o/vendor/github.com/containernetworking/cni/scripts/docker-run.sh
Mrunal Patel 8e5b17cf13 Switch to github.com/golang/dep for vendoring
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-01-31 16:45:59 -08:00

21 lines
501 B
Bash
Executable file

#!/bin/bash
# Run a docker container with network namespace set up by the
# CNI plugins.
# Example usage: ./docker-run.sh --rm busybox /sbin/ifconfig
contid=$(docker run -d --net=none busybox:latest /bin/sleep 10000000)
pid=$(docker inspect -f '{{ .State.Pid }}' $contid)
netnspath=/proc/$pid/ns/net
./exec-plugins.sh add $contid $netnspath
function cleanup() {
./exec-plugins.sh del $contid $netnspath
docker kill $contid >/dev/null
}
trap cleanup EXIT
docker run --net=container:$contid $@