Install Ubuntu 22.04
apt update
apt install docker.io
==
docker images
docker ps
vim /etc/apt/resolve.conf
nameserver 10.202.10.202 #shekan
docker pull alpine:latest
docker load -i /path/alpine.tar
#create container based on alpine
docker run -dit --name alp1 alpine
docker exec alp2 ip a
docker exec alp2 ping ..
docker attach alp2
CTRL+p+q
ls /var/lib/docker
ls /var/lib/docker/containers
usermod -aG docker user1
service docker restart
docker start alp1
docker ps
brctl show #list all bridge
docker network ls
docker network create mynet
docker run -dit -name alp3 --net mynet alpine
docker run -dit --name alp4 --net mynet alpine
docker exec alp3 ping alp4
docker network inspect mynet
docker run -dit --name mynginx nginx:alpine
docker rm -f mynginx
docker run -dit --name mynginx nginx:alpine 80:80
#################################
192.168.56.1
ZDsoft recorder
-----------------------------------
docker images
docker pull nginx:alpine
scp ....
docker load -i /home/nginx-alpine.tar
docker images
mkdir project1
cd project1
echo MySite > index.html
nano DockerFile
from nginx:alpine
copy index.html /usr/share/www/index.html
docker build -t web .
docker ps
docker run -dit --name mynginx -p 80:80 nginx:alpine
docker ps
docker rm -f mynginx
docker run -dit --name mynginx -p 80:80 web
docker ps
docker network create mynet
docker run -dit --name alp3 mynet alpine
docker run -dit --name alp4 mynet alpine
docker exec alp4 ip a
docker exec alp4 ping 172.18.0.2
docker exec alp4 ping alp3
docker exec alp4 ping alp1
# name discovery on user defined bridge
iptables -I DOCKER-USER -i docker0 -o br-fc... -j ACCEPT
iptables -I DOCKER-USER -o docker0 -i br-fc... -j ACCEPT
docker exec alp4 ping alp1
docker netwrok inspect
docker rm -f mynginx
docker run -dit --name mynginx --net host web # no need to publish port like 80:80 because its on host network
----------------
docker network create -d macvlan --subnet 192.168.93.0 --iprange 192.168.93.192/26 -o parent ens33 --gateway 192.168.93.2 macvlan1
docker run -dit --name alp5 --net macvlan alpine
docker exec alp5 ip a
docker network inspect macvlan1
----------------
ip netns add ns1
ip netns add ns2
ip link add veth0
ip -n ns0 link
ip netns
ip link
ip netns add ns0
ip -n ns0 link
clear
ip netns add ns1
ip link add veth0 type veth peer name veth1
ip link
clear
ip link set veth0 netns ns0
ip -n ns0 link
ip link set veth1 netns ns1
ip -n ns0 link set veth0 up
ip -n ns0 link set lo up
ip -n ns0 addr add 10.0.1.1/24 dev veth0
ip -n ns1 link set veth1 up
ip -n ns1 link set lo up
ip -n ns1 addr add 10.0.2.1/24 dev veth1
ip -n ns0 a
clear
ip netns exec ns0 ping 10.0.2.1
ip -n ns0 route add 10.0.2.0/24 dev veth0
ip -n ns1 route add 10.0.1.0/24 dev veth1
ip netns exec ns0 ping 10.0.2.1
clear
history
ip netns