دستورات اولیه کار با داکر و تنظیمات اولیه.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
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 |