# Understand Docker Work ###### tags: `docker' [TOC] --- ### 1: VM Network bridge adapter is to connect the VM directly to home network ``` ip address show ``` ![image](https://hackmd.io/_uploads/SyAsoiseR.png) if you have install docker, when you run previous command you will find dn name "docker0" --- ### 2: the Default Bridge ![image](https://hackmd.io/_uploads/S1zF6isgA.png) ``` sudo docker network ls ``` ![image](https://hackmd.io/_uploads/H1Rw3isxC.png) the architecture mention 3 docker container name Thor, mjolnir, stormbreaker. and now I change it to zyzy, w-agf, pearl ![image](https://hackmd.io/_uploads/Hyt_1njeA.png) ``` sudo docker run -itd --rm --name zyzy busybox sudo docker run -itd --rm --name w-agf busybox sudo docker run -itd --rm --name pearl busybox ``` ![image](https://hackmd.io/_uploads/B1sZxnogC.png) ``` bridge link ``` ![image](https://hackmd.io/_uploads/Hyojx2sgC.png) ``` sudo docker inspect bridge ``` ![image](https://hackmd.io/_uploads/ryemb3olA.png) docker0 as a switch and all docker container can talk each other all day. #### NAT Masquerade ``` sudo docker exec -it zyzy sh ``` ![image](https://hackmd.io/_uploads/SJb4Q2ig0.png) show ip address ``` ip add ``` ![image](https://hackmd.io/_uploads/B1tB7hsxC.png) ping to another container ``` ping 172.17.0.3 ``` ![image](https://hackmd.io/_uploads/Bku9mnoxC.png) ping to google ``` ping 8.8.8.8 ``` ![image](https://hackmd.io/_uploads/By5j7njeR.png) ``` ip route ``` ![image](https://hackmd.io/_uploads/H1lFnQnslR.png) ---