创建网络
docker network create springcloud
查看网络
docker network ls
指定网络
docker run --rm -it --network=springcloud test bash
networks: springcloud: external: true
networks: my-network: external: name: springcloud
version: '3' services: myapp: image: my-image networks: - springcloud networks: springcloud: driver: bridge
指定hostname
docker run --rm -it --network=springcloud --hostname=node1 test bash
docker run --rm -it --network=springcloud --hostname=node2 test bash
网络工具
sudo apt install iputils-ping