- node容器与mysql容器通信
- mysql容器对外暴露出3306端口,但node容器访问不了
- 采用桥接法
docker network create -d bridge test-net
docker run -itd --name test1 --network test-net container1
docker run -itd --name test2 --network test-net container2 - docker network ls 查看network id
docker network inspect id 查看桥接的对象内有哪些容器 - node容器访问mysql时,可用ip地址来访问.
image.png
网友评论