Compare commits

...

2 Commits

Author SHA1 Message Date
Twoje Imię Nazwisko fd82f97ac0 u 2024-10-25 08:48:37 -04:00
filih cf225129a5 added expose-nets 2024-10-23 09:09:50 +02:00
8 changed files with 44 additions and 5 deletions

View File

@ -28,9 +28,9 @@ RUN apt-get update && apt-get install -y \
RUN echo "root:rootpass" | chpasswd RUN echo "root:rootpass" | chpasswd
# Tworzenie nowego użytkownika 'user' z hasłem 'pass' i dodanie do grupy sudo # Tworzenie nowego użytkownika 'user' z hasłem 'pass' i dodanie do grupy sudo
RUN useradd -m -s /bin/bash user && \ #RUN useradd -m -s /bin/bash user && \
echo "user:pass" | chpasswd && \ # echo "user:pass" | chpasswd && \
usermod -aG sudo user # usermod -aG sudo user
# Opcjonalnie: Ustawienie domyślnego użytkownika # Opcjonalnie: Ustawienie domyślnego użytkownika
# USER user # USER user
@ -38,3 +38,4 @@ RUN useradd -m -s /bin/bash user && \
# Ustawienie domyślnego polecenia # Ustawienie domyślnego polecenia
CMD ["/bin/bash"] CMD ["/bin/bash"]

2
__vp
View File

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

1
app

@ -1 +0,0 @@
Subproject commit db0752d3e05f90f7fd8dda802b2366f3c6942b87

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