added expose-nets

This commit is contained in:
filih 2024-10-23 09:09:50 +02:00
parent 1456a876ab
commit cf225129a5
5 changed files with 39 additions and 0 deletions

1
doc/git-log.txt Normal file
View File

@ -0,0 +1 @@
git submodule add -b z1 http://t:f6ad1fe79d0b929d8def3339dafcbf919f311acf@qstack.pl:3000/c2023/p22.10 app

1
run/__ Normal file
View File

@ -0,0 +1 @@
f() { sudo docker run --rm -dit --privileged --name "$1" deb su - user; }; f deb1

6
run/__v Normal file
View File

@ -0,0 +1,6 @@
f() {
sudo docker run --rm -dit --privileged \
-v "$(pwd)/app:/home/user/work" \
--name "$1" deb su - user;
};
f $1

7
run/__vp Normal file
View File

@ -0,0 +1,7 @@
f() {
sudo docker run --rm -dit --privileged \
-v "$(pwd)/app:/home/user/work" \
-p 3333:3333 \
--name "$1" deb su - user;
};
f $1

24
script/expose-netns.sh Normal file
View File

@ -0,0 +1,24 @@
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: $0 <container id or name>"
exit 1
fi
echo "expose container $1 netns"
NETNS=`sudo docker inspect -f '{{.State.Pid}}' $1`
if [ ! -d /var/run/netns ]; then
sudo mkdir /var/run/netns
fi
if [ -f /var/run/netns/$NETNS ]; then
sudo rm -rf /var/run/netns/$NETNS
fi
sudo ln -s /proc/$NETNS/ns/net /var/run/netns/$NETNS
echo "done. netns: $NETNS"
echo "============================="
echo "current network namespaces: "
echo "============================="
ip netns